Part Number Hot Search : 
AN6540 EP16F P6KE27 RFR4104 A2108 SS50AT MTDS535C SI4204DY
Product Description
Full Text Search
 

To Download PD750104 Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  m pd750108 4 bit single-chip microcontroller 1996 user's manual m PD750104 m pd750106 m pd750108 m pd75p0116 document no. u11330ej2v0um00 (2nd edition) date published march 1997 j printed in japan
[memo]
1 2 3 4 5 6 7 8 9 10 general features of the architecture and memory map mask option reset function interrupt and test functions peripheral hardware functions internal cpu functions pin functions a b c 11 d e hardware index instruction index masked rom ordering procedure development tools functions of the m pd750008, m pd750108, and m pd75p0116 instruction set writing to and verifying program memory (prom) standby function f revision history
ms-dos is a trademark of microsoft corporation. ibm dos, pc/at, and pc dos are trademarks of ibm corporation. notes for cmos devices 1 precaution against esd for semiconductors note: strong electric field, when exposed to a mos device, can cause destruction of the gate oxide and ultimately degrade the device operation. steps must be taken to stop generation of static electricity as much as possible, and quickly dissipate it once, when it has occurred. environmental control must be adequate. when it is dry, humidifier should be used. it is recommended to avoid using insulators that easily build static electricity. semiconductor devices must be stored and transported in an anti-static container, static shielding bag or conductive material. all test and measurement tools including work bench and floor should be grounded. the operator should be grounded using wrist strap. semiconductor devices must not be touched with bare hands. similar precautions need to be taken for pw boards with semiconductor devices on it. 2 handling of unused input pins for cmos note: no connection for cmos device inputs can be cause of malfunction. if no connection is provided to the input pins, it is possible that an internal input level may be generated due to noise, etc., hence causing malfunction. cmos devices behave differently than bipolar or nmos devices. input levels of cmos devices must be fixed high or low by using a pull-up or pull-down circuitry. each unused pin should be connected to v dd or gnd with a resistor, if it is considered to have a possibility of being an output pin. all handling related to the unused pins must be judged device by device and related specifications governing the devices. 3 status before initialization of mos devices note: power-on does not necessarily define initial status of mos device. production process of mos does not define the initial operation status of the device. immediately after the power source is turned on, the devices with reset function have not yet been initialized. hence, power-on does not guarantee out-pin levels, i/o settings or contents of registers. device is not initialized until the reset signal is received. reset operation must be executed immediately after power-on for devices having reset function.
the export of this product from japan is regulated by the japanese government. to export this product may be prohibited without governmental license, the need for which must be judged by the customer. the export or re-export of this product from a country other than japan may also be prohibited without a license from that country. please call an nec sales representative. the information in this document is subject to change without notice. no part of this document may be copied or reproduced in any form or by any means without the prior written consent of nec corporation. nec corporation assumes no responsibility for any errors which may appear in this document. nec corporation does not assume any liability for infringement of patents, copyrights or other intellectual property rights of third parties by or arising from use of a device described herein or any other liability arising from use of such device. no license, either express, implied or otherwise, is granted under any patents, copyrights or other intellectual property rights of nec corporation or others. while nec corporation has been making continuous effort to enhance the reliability of its semiconductor devices, the possibility of defects cannot be eliminated entirely. to minimize risks of damage or injury to persons or property arising from a defect in an nec semiconductor device, customers must incorporate sufficient safety measures in its design, such as redundancy, fire-containment, and anti-failure features. nec devices are classified into the following three quality grades: "standard", "special", and "specific". the specific quality grade applies only to devices developed based on a customer designated "quality assurance program" for a specific application. the recommended applications of a device depend on its quality grade, as indicated below. customers must check the quality grade of each device before using it in a particular application. standard: computers, office equipment, communications equipment, test and measurement equipment, audio and visual equipment, home electronic appliances, machine tools, personal electronic equipment and industrial robots special: transportation equipment (automobiles, trains, ships, etc.), traffic control systems, anti-disaster systems, anti-crime systems, safety equipment and medical equipment (not specifically designed for life support) specific: aircrafts, aerospace equipment, submersible repeaters, nuclear reactor control systems, life support systems or medical equipment for life support, etc. the quality grade of nec devices is "standard" unless otherwise specified in nec's data sheets or data books. if customers intend to use nec devices for applications other than those specified for standard quality grade, they should contact an nec sales representative in advance. anti-radioactive design is not implemented in this product. m7 96. 5
nec electronics inc. (u.s.) santa clara, california tel: 800-366-9782 fax: 800-729-9288 nec electronics (germany) gmbh duesseldorf, germany tel: 0211-65 03 02 fax: 0211-65 03 490 nec electronics (uk) ltd. milton keynes, uk tel: 01908-691-133 fax: 01908-670-290 nec electronics italiana s.r.1. milano, italy tel: 02-66 75 41 fax: 02-66 75 42 99 nec electronics hong kong ltd. hong kong tel: 2886-9318 fax: 2886-9022/9044 nec electronics hong kong ltd. seoul branch seoul, korea tel: 02-528-0303 fax: 02-528-4411 nec electronics singapore pte. ltd. united square, singapore 1130 tel: 253-8311 fax: 250-3583 nec electronics taiwan ltd. taipei, taiwan tel: 02-719-2377 fax: 02-719-5951 nec do brasil s.a. sao paulo-sp, brasil tel: 011-889-1680 fax: 011-889-1689 nec electronics (germany) gmbh benelux office eindhoven, the netherlands tel: 040-2445845 fax: 040-2444580 nec electronics (france) s.a. velizy-villacoublay, france tel: 01-30-67 58 00 fax: 01-30-67 58 99 nec electronics (france) s.a. spain office madrid, spain tel: 01-504-2787 fax: 01-504-2860 nec electronics (germany) gmbh scandinavia office taeby, sweden tel: 08-63 80 820 fax: 08-63 80 388 regional information some information contained in this document may vary from country to country. before using any nec product in your application, please contact the nec office in your country to obtain a list of authorized representatives and distributors. they will verify: ? device availability ? ordering information ? product release schedule ? availability of related technical literature ? development environment specifications (for example, specifications for third-party tools and components, host computers, power plugs, ac supply voltages, and so forth) ? network requirements in addition, trademarks, registered trademarks, export restrictions, and other legal issues may also vary from country to country. j96. 8
major changes page description throughout the m PD750104, m pd750106, m pd750108, and m pd75p0116 have already been developed. data bus pins (d0-d7) have been added. p.21 section 2.4 has been changed. pp.234 to 235 section 9.2 has been changed. p.236 section 9.3 has been changed. pp.303 to 304 the target for comparison, in the table of appendix a has been changed from the m pd75008 to the m pd750008. p.325 appendix f has been added. the mark * shows major revised points.
[memo]
preface readers this manual is intended for engineers who want to learn the capabilities of the m PD750104, m pd750106, m pd750108, and m pd75p0116 to develop application sys- tems based on them. purpose the purpose of this manual is to help users understand the hardware capabilities (shown below) of the m PD750104, m pd750106, m pd750108, and m pd75p0116. configuration this manual is roughly divided as follows: ? general ? pin functions ? architecture feature and memory map ? internal cpu functions ? peripheral hardware functions ? interrupt and test functions ? standby function ? reset function ? writing to and verifying program memory (prom) ? mask option ? instruction set guidance readers of this manual should have general knowledge of the electronics, logical circuit, and microcomputer fields. ? for users who have used the m pd750008: C> see appendix a to check for any difference in the functions and read the explanation of those differences. ? to check the functions of an instruction in detail when the reader knows its mnemonics: C> see the instruction index in appendix d . ? to check the functions of specific internal circuits, etc.: C> see appendix e . ? to understand the overall functions of the m PD750104, m pd750106, m pd750108, and m pd75p0116: C> read through all chapters sequentially.
notation data bit significance : higher-order bits on the left side lower-order bits on the right side active low : xxx (pin and signal names are overscored.) memory map address : low-order address on the upper side high-order address on the lower side note : explanation of an indicated part of text caution : information requesting the user's special attention remark : supplementary information important and emphasized matter : described in bold face numeric value : binary .................. xxxx or xxxxb decimal ............... xxxx hexadecimal ....... xxxxh
related documents some documents are preliminary editions, but they are not so specified in the tables below. documents related to devices document name document number japanese english m PD750104, 750106, 750108 data sheet to be prepared to be prepared m pd75p0116 data sheet to be prepared to be prepared m pd750108 user?s manual u11330j u11330e (this manual) m pd750008, 750108 instruction list u11456j ? 75xl series selection guide u10453j u10453e documents related to development tools document name document number japanese english hardware ie-75000-r/ie-75001-r users manual eeu-846 eeu-1416 ie-75300-r-em users manual u11354j u11354e ep-75008cu-r users manual eeu-699 eeu-1317 ep-75008gb-r user's manual eeu-698 eeu-1305 pg-1500 users manual u11940j eeu-1335 software ra75x assembler package users operation eeu-731 eeu-1346 manual language eeu-730 eeu-1363 pg-1500 controller pc-9800 series (ms-dos tm ) base eeu-704 eeu-1291 users manual ibm pc series (pc dos tm ) base eeu-5008 u10540e other documents document name document number japanese english ic package manual c10943x semiconductor device mounting technology manual c10535j c10535e quality grade on nec semiconductor devices c11531j c11531e reliability and quality control of nec semiconductor devices c10983j c10983e electrostatic discharge (esd) test mem-539 semiconductor device quality guarantee guide mei-603 mei-1202 microcontroller-related products guide - by third parties u11416j caution the above related documents are subject to change without notice. be sure to use the latest edition when you design your system. *
[memo]
- i - contents chapter 1 general .......................................................................................................................... 1 1.1 function overview .......................................................................................... 2 1.2 ordering information .................................................................................... 3 1.3 differences among m pd750108 subseries products ........................ 4 1.4 block diagram ................................................................................................... 5 1.5 pin configuration (top view) ...................................................................... 6 chapter 2 pin functions ............................................................................................................... 9 2.1 pin functions of the m pd750108 .................................................................. 9 2.2 pin functions ..................................................................................................... 13 2.2.1 p00-p03 (port0), p10-p13 (port1) ...................................................... 13 2.2.2 p20-p23 (port2), p30-p33 (port3), p40-p43 (port4), p50-p53 (port5), p60-p63 (port6), p70-p73 (port7) ..................... 13 2.2.3 p80, p81 (port8) ...................................................................................... 14 2.2.4 ti0 ............................................................................................................... 14 2.2.5 pto0, pto1 ............................................................................................... 15 2.2.6 pcl .............................................................................................................. 15 2.2.7 buz ............................................................................................................. 15 2.2.8 sck, so/sb0, si/sb1 ................................................................................ 15 2.2.9 int4 ............................................................................................................. 15 2.2.10 int0, int1 ................................................................................................... 16 2.2.11 int2 ............................................................................................................. 16 2.2.12 kr0-kr3, kr4-kr7 .................................................................................... 17 2.2.13 cl1, cl2 ..................................................................................................... 17 2.2.14 xt1, xt2 ..................................................................................................... 17 2.2.15 reset ........................................................................................................ 18 2.2.16 v dd .............................................................................................................. 18 2.2.17 v ss .............................................................................................................. 18 2.2.18 ic (for the m PD750104, m pd750106, and m pd750108 only) ................... 18 2.2.19 v pp (for the m pd75p0116 only) ................................................................. 18 2.2.20 md0-md3 (for the m pd75p0116 only) ....................................................... 18 2.2.21 d0-d7 (for the m pd75p0116 only) ............................................................. 18 2.3 pin input/output circuits ............................................................................. 19 2.4 connection of unused pins ......................................................................... 21 chapter 3 features of the architecture and memory map ....................................... 23 3.1 data memory bank structure and addressing modes .................. 23 *
- ii - 3.1.1 data memory bank structure ..................................................................... 23 3.1.2 data memory addressing modes ............................................................... 25 3.2 general register bank configuration .................................................. 36 3.3 memory-mapped i/o ........................................................................................... 41 chapter 4 internal cpu functions .......................................................................................... 47 4.1 mk i mode/mk ii mode switch functions .................................................... 47 4.1.1 differences between mk i mode and mk ii mode ..................................... 47 4.1.2 setting of the stack bank selection register (sbs) ................................ 48 4.2 program counter (pc) .................................................................................. 49 4.3 program memory (rom) ................................................................................. 50 4.4 data memory (ram) ........................................................................................... 55 4.4.1 data memory configuration ........................................................................ 55 4.4.2 specification of a data memory bank ........................................................ 56 4.5 general register ............................................................................................. 58 4.6 accumulator ...................................................................................................... 59 4.7 stack pointer (sp) and stack bank select register (sbs) ............ 60 4.8 program status word (psw) ....................................................................... 64 4.9 bank select register (bs) ............................................................................ 67 chapter 5 peripheral hardware functions ....................................................................... 69 5.1 digital i/o ports .............................................................................................. 69 5.1.1 types, features, and configurations of digital i/o ports ........................ 70 5.1.2 i/o mode setting ......................................................................................... 76 5.1.3 digital i/o port manipulation instructions .................................................. 78 5.1.4 digital i/o port operation ........................................................................... 81 5.1.5 specification of built-in pull-up resistors ................................................. 83 5.1.6 i/o timing of digital i/o ports .................................................................... 84 5.2 clock generator ............................................................................................. 86 5.2.1 clock generator configuration ................................................................... 86 5.2.2 functions and operations of the clock generator ................................... 87 5.2.3 system clock and cpu clock setting ....................................................... 98 5.2.4 clock output circuit .................................................................................... 100 5.3 basic interval timer/watchdog timer .................................................... 103 5.3.1 configuration of the basic interval timer/watchdog timer ..................... 103 5.3.2 basic interval timer mode register (btm) ............................................... 103 5.3.3 watchdog timer enable flag (wdtm) ...................................................... 105 5.3.4 operation of the basic interval timer ........................................................ 105 5.3.5 operation of the watchdog timer .............................................................. 106 5.3.6 other functions .......................................................................................... 107
- iii - 5.4 clock timer ......................................................................................................... 108 5.4.1 configuration of the clock timer ............................................................... 109 5.4.2 clock mode register .................................................................................. 109 5.5 timer/event counter ...................................................................................... 111 5.5.1 configuration of timer/event counter ....................................................... 111 5.5.2 8-bit timer/event counter mode operation .............................................. 117 5.5.3 notes on timer/event counter applications .............................................. 123 5.6 serial interface ............................................................................................... 126 5.6.1 serial interface functions ........................................................................... 126 5.6.2 configuration of serial interface ................................................................ 127 5.6.3 register functions ...................................................................................... 130 5.6.4 operation halt mode ................................................................................... 138 5.6.5 three-wire serial i/o mode operations .................................................... 140 5.6.6 two-wire serial i/o mode .......................................................................... 147 5.6.7 sbi mode operation ................................................................................... 153 5.6.8 manipulation of sck pin output ................................................................ 182 5.7 bit sequential buffer .................................................................................... 184 chapter 6 interrupt and test functions ............................................................................. 187 6.1 configuration of the interrupt control circuit ........................... 187 6.2 types of interrupt sources and vector tables ............................. 189 6.3 various devices to control interrupt functions .......................... 191 6.4 interrupt sequence ....................................................................................... 199 6.5 multiple interrupt processing control .............................................. 200 6.6 processing of interrupts sharing a vector address ................. 202 6.7 machine cycles for starting interrupt processing .................... 204 6.8 effective use of interrupts ...................................................................... 206 6.9 interrupt applications ................................................................................. 206 6.10 test function ..................................................................................................... 214 6.10.1 test sources ............................................................................................... 214 6.10.2 hardware to control test functions .......................................................... 214 chapter 7 standby function ...................................................................................................... 219 7.1 setting of standby modes and operation status ........................... 220 7.2 release of the standby modes .................................................................. 221 7.3 operation after a standby mode is released ................................... 223 7.4 selection of a mask option ......................................................................... 223 7.5 applications of the standby modes ........................................................ 224
- iv - chapter 8 reset function ........................................................................................................... 229 chapter 9 writing to and verifying program memory (prom) .................................. 233 9.1 operating modes when writing to and verifying the program memory ................................................................................................................. 234 9.2 writing to the program memory .............................................................. 234 9.3 reading the program memory ................................................................... 236 9.4 screening of one-time prom ....................................................................... 237 chapter 10 mask option .................................................................................................................. 239 10.1 pin ............................................................................................................................ 239 10.2 mask option of standby function ............................................................ 239 10.3 mask option for feedback resistor of subsystem clock .......... 240 chapter 11 instruction set .......................................................................................................... 241 11.1 unique instructions ....................................................................................... 241 11.1.1 geti instruction ........................................................................................ 241 11.1.2 bit manipulation instruction ...................................................................... 242 11.1.3 string-effect instructions .......................................................................... 242 11.1.4 number system conversion instructions ................................................. 243 11.1.5 skip instructions and the number of machine cycles required for a skip ........................................................................................................... 244 11.2 instruction set and operation ................................................................. 245 11.3 instruction codes of each instruction ............................................... 262 11.4 functions and applications of the instructions ............................ 268 11.4.1 transfer instructions ................................................................................. 268 11.4.2 table reference instructions ................................................................... 274 11.4.3 bit transfer instructions ........................................................................... 277 11.4.4 arithmetic/logical instructions .................................................................. 277 11.4.5 accumulator manipulation instructions .................................................... 283 11.4.6 increment/decrement instructions ........................................................... 283 11.4.7 compare instructions ................................................................................ 284 11.4.8 carry flag manipulation instructions ....................................................... 285 11.4.9 memory bit manipulation instructions ...................................................... 286 11.4.10 branch instructions ................................................................................... 288 11.4.11 subroutine stack control instructions ...................................................... 293 11.4.12 interrupt control instructions .................................................................... 297 11.4.13 i/o instructions .......................................................................................... 298 11.4.14 cpu control instructions .......................................................................... 299 11.4.15 special instructions ................................................................................... 299
- v - appendix a functions of the m pd750008, m pd750108, and m pd75p0116 ........................... 303 appendix b development tools .................................................................................................. 305 appendix c masked rom ordering procedure ..................................................................... 313 appendix d instruction index ...................................................................................................... 315 d.1 instruction index (by function) ................................................................ 315 d.2 instruction index (alphabetical order) ................................................ 318 appendix e hardware index .......................................................................................................... 321 e.1 hardware index (alphabetical order with respect to the hardware name) ................................................................................................ 321 e.2 hardware index (alphabetical order with respect to the hardware symbol) ........................................................................................... 323 appendix f revision history ......................................................................................................... 325 *
- vi - list of figures (1/4) figure no. title page 2-1 pin input/output circuits ................................................................................................... 19 3-1 use of mbe = 0 mode and mbe = 1 mode ...................................................................... 24 3-2 data memory organization and addressing range of each addressing mode ............ 26 3-3 updating static ram addresses ....................................................................................... 30 3-4 example of register bank selection ................................................................................ 37 3-5 general register configuration (4-bit processing) .......................................................... 39 3-6 general register configuration (8-bit processing) .......................................................... 40 3-7 m pd750108 i/o map .......................................................................................................... 42 4-1 stack bank selection register format ............................................................................. 48 4-2 program counter organization ......................................................................................... 49 4-3 program memory map (in m PD750104) ............................................................................ 51 4-4 program memory map (in m pd750106) ............................................................................ 52 4-5 program memory map (in m pd750108) ............................................................................ 53 4-6 program memory map (in m pd75p0116) .......................................................................... 54 4-7 data memory map ............................................................................................................. 56 4-8 general register format ................................................................................................... 58 4-9 register pair format ......................................................................................................... 59 4-10 accumulator ....................................................................................................................... 59 4-11 format of stack pointer and stack bank select register ............................................... 61 4-12 data saved to the stack memory (mk i mode) ................................................................ 62 4-13 data restored from the stack memory (mk i mode) ....................................................... 62 4-14 data saved to the stack memory (mk ii mode) ............................................................... 63 4-15 data restored from the stack memory (mk ii mode) ...................................................... 63 4-16 program status word format ........................................................................................... 64 4-17 bank select register format ............................................................................................ 67 5-1 data memory addresses of digital ports .......................................................................... 69 5-2 configurations of ports 0 and 1 ........................................................................................ 71 5-3 configurations of ports 2 and 7 ........................................................................................ 72 5-4 configurations of ports 3n and 6n (n = 0 to 3) ................................................................. 73 5-5 configurations of ports 4 and 5 ........................................................................................ 74 5-6 configuration of port 8 ...................................................................................................... 75 5-7 formats of port mode registers ....................................................................................... 77 5-8 pull-up resistor specification register format ............................................................... 84
- vii - list of figures (2/4) figure no. title page 5-9 i/o timing chart of digital i/o ports ................................................................................. 84 5-10 on timing chart of built-in pull-up resistor connected by software ......................... 85 5-11 block diagram of the clock generator ............................................................................. 86 5-12 format of the processor clock control register .............................................................. 89 5-13 format of the system clock control register .................................................................. 90 5-14 external circuit for the main system clock oscillator ..................................................... 91 5-15 external circuit for the subsystem clock oscillator ......................................................... 91 5-16 examples of oscillator connections which should be avoided .................................... 92 5-17 subsystem clock oscillator ............................................................................................... 96 5-18 sub-oscillator control register (sos) format ................................................................ 97 5-19 changing the system clock and cpu clock .................................................................... 99 5-20 configuration of the clock output circuit ......................................................................... 100 5-21 format of the clock output mode register ...................................................................... 101 5-22 application to remote control waveform output ............................................................ 102 5-23 block diagram of the basic interval timer/watchdog timer ........................................... 103 5-24 format of the basic interval timer mode register .......................................................... 104 5-25 format of the watchdog timer enable flag (wdtm) ...................................................... 105 5-26 block diagram of the clock timer .................................................................................... 109 5-27 clock mode register format ............................................................................................ 110 5-28 block diagram of the timer/event counter (channel 0) ................................................. 112 5-29 block diagram of the timer counter (channel 1) ............................................................ 113 5-30 timer/event counter mode register (channel 0) format ............................................... 115 5-31 timer counter mode register (channel 1) format .......................................................... 116 5-32 timer/event counter output enable flag format ............................................................ 117 5-33 timer/event counter mode register setup ...................................................................... 118 5-34 timer/event counter output enable flag setup .............................................................. 119 5-35 configuration of timer/event counter .............................................................................. 121 5-36 count operation timing .................................................................................................... 122 5-37 error at the start of the timer ........................................................................................... 123 5-38 example of the sbi system configuration ....................................................................... 127 5-39 block diagram of the serial interface ............................................................................... 128 5-40 format of serial operation mode register (csim) .......................................................... 130 5-41 format of serial bus interface control register (sbic) .................................................. 134 5-42 peripheral hardware of shift register .............................................................................. 137 5-43 example of three-wire serial i/o system configuration ................................................. 140 5-44 timing of three-wire serial i/o mode .............................................................................. 143
- viii - list of figures (3/4) figure no. title page 5-45 operations of relt and cmdt ........................................................................................ 144 5-46 transfer bit switching circuit ............................................................................................ 144 5-47 example of two-wire serial i/o system configuration ................................................... 147 5-48 timing of two-wire serial i/o mode ................................................................................. 150 5-49 operations of relt and cmdt ........................................................................................ 151 5-50 example of sbi system configuration .............................................................................. 153 5-51 timing of sbi transfer ...................................................................................................... 155 5-52 bus release signal ........................................................................................................... 156 5-53 command signal ............................................................................................................... 156 5-54 address .............................................................................................................................. 156 5-55 slave selection using an address .................................................................................... 157 5-56 command ........................................................................................................................... 157 5-57 data .................................................................................................................................... 157 5-58 acknowledge signal .......................................................................................................... 158 5-59 busy and ready signals ................................................................................................... 159 5-60 operations of relt, cmdt, reld, and cmdd (master) ............................................... 164 5-61 operations of relt, cmdt, reld, and cmdd (slave) ................................................. 164 5-62 operation of ackt ............................................................................................................ 165 5-63 operation of acke ............................................................................................................ 165 5-64 operation of ackd ............................................................................................................ 166 5-65 operation of bsye ............................................................................................................ 167 5-66 pin configuration ............................................................................................................... 170 5-67 address transfer operation from master device to slave device (wup = 1) .............. 172 5-68 command transfer operation from master device to slave device .............................. 173 5-69 data transfer operation from master device to slave device ....................................... 174 5-70 data transfer operation from slave device to master device ....................................... 175 5-71 example of serial bus configuration ................................................................................ 177 5-72 transfer format of the read command ......................................................................... 178 5-73 transfer format of the write and end commands ...................................................... 179 5-74 transfer format of the stop command .......................................................................... 179 5-75 transfer format of the status command ..................................................................... 180 5-76 status format of the status command ........................................................................ 180 5-77 transfer format of the reset command ....................................................................... 181 5-78 transfer format of the chgmst command .................................................................... 181 5-79 master and slave operation in case of error .................................................................. 182 5-80 sck/p01 pin circuit configuration ................................................................................... 183 5-81 format of the bit sequential buffer .................................................................................. 184
- ix - list of figures (4/4) figure no. title page 6-1 block diagram of interrupt control circuit ........................................................................ 188 6-2 interrupt vector table ........................................................................................................ 189 6-3 interrupt priority specification register ............................................................................ 193 6-4 configurations of the int0, int1, and int4 circuits ....................................................... 195 6-5 i/o timing of a noise eliminator ....................................................................................... 196 6-6 format of edge detection mode registers ...................................................................... 197 6-7 interrupt sequence ............................................................................................................ 199 6-8 multiple interrupt processing by a high-order interrupt .................................................. 200 6-9 multiple interrupt processing by changing the interrupt status flags ........................... 201 6-10 block diagram of the int2 and kr0 to kr7 circuits ....................................................... 216 6-11 format of int2 edge detection mode register (im2) ..................................................... 217 7-1 standby mode release operation .................................................................................... 221 8-1 configuration of reset functions ...................................................................................... 229 8-2 reset operation by generation of reset signal ........................................................... 229 b-1 drawings of the ev-9200g-44 (reference) ...................................................................... 310 b-2 recommended pattern on boards for the ev-9200g-44 (reference) ........................... 311
- x - list of tables (1/2) table no. title page 2-1 digital i/o port pins (1/2) .................................................................................................. 9 2-2 non-port pin functions (1/2) ............................................................................................. 11 2-3 connection of unused pins ............................................................................................... 21 3-1 addressing modes ............................................................................................................. 27 3-2 register bank to be selected with the rbe and rbs ..................................................... 36 3-3 recommended use of register banks with normal routines and interrupt routines .. 36 3-4 addressing modes applicable to peripheral hardware operation .................................. 41 4-1 differences between mk i mode and mk ii mode ............................................................. 47 4-2 stack area to be selected by the sbs ............................................................................ 60 4-3 psw flags saved/restored in stack operation .............................................................. 64 4-4 carry flag manipulation instructions ................................................................................ 65 4-5 information indicated by the interrupt status flag ........................................................... 66 4-6 register bank to be selected with the rbe and rbs ..................................................... 68 5-1 types and features of digital ports ................................................................................. 70 5-2 i/o pin manipulation instructions ...................................................................................... 80 5-3 operations by i/o port manipulation instructions ............................................................. 82 5-4 specification of built-in pull-up resistors ........................................................................ 83 5-5 maximum time required to change the system clock and cpu clock ....................... 98 5-6 resolution and longest setup time ................................................................................. 120 5-7 serial clock selection and application (in the three-wire serial i/o mode) ................. 143 5-8 serial clock selection and application (in the two-wire serial i/o mode) .................... 151 5-9 serial clock selection and application (in the sbi mode) ............................................... 163 5-10 various signals used in the sbi mode ............................................................................. 168 6-1 interrupt sources ............................................................................................................... 189 6-2 set signals for interrupt request flags ............................................................................ 192 6-3 interrupt processing statuses of ist0 and ist1 .............................................................. 198 6-4 identifying interrupt sharing vector table address ......................................................... 202 6-5 test source ........................................................................................................................ 214 6-6 signals setting test request flags .................................................................................. 214 7-1 operation statuses in the standby mode ......................................................................... 220
- xi - list of tables (2/2) table no. title page 8-1 status of the hardware after a reset ............................................................................... 230 10-1 selecting mask option of pin ............................................................................................ 239 11-1 types of bit manipulation addressing modes and specification range ........................ 242
- xii - [memo]
1 chapter 1 general chapter 1 general the m PD750104, m pd750106, m pd750108, and m pd75p0116 are 75xl series 4-bit single-chip microcontrollers. the 75xl series is a successor of the 75x series consisting of many products. these m PD750104, m pd750106, m pd750108, and m pd75p0116 are collectively called the m pd750108 subseries. the m pd750108 subseries is produced by replacing the main system clock oscillator of the m pd750008 subseries with an rc oscillator, enabling operation at the relatively low voltage of 1.8 v. the 75xl series takes over the cpus of the 75x series, realizing a wide range of operating voltages. in addition to having upward compatibility with existing products, the 75xl series is best suited for battery-driven applications. the m PD750104, m pd750106, m pd750108, and m pd75p0116 have the following features: built-in rc oscillator for main system clock oscillation, enabling the immediate start of processing after the release of standby mode. operable on low voltage: v dd = 1.8 to 5.5 v switchable instruction execution times (useful for power saving) 4, 8, 16, 64 m s (at 1 mhz) 2, 4, 8, 32 m s (at 2 mhz) 122 m s (at 32.768 khz) enhanced timers: 4 channels easy replacement (the functions and instructions of the m pd750008 are taken over.) the m pd75p0116, having the electrically programmable one-time prom, is pin-compatible with the m PD750104, m pd750106, and m pd750108. it is suitable for small-scale production or prototype production in system development. applications ? camera ? meter ? automobile ? pager remark this manual will explain only the m pd750108 when the m pd750108, m PD750104, m pd750106, and m pd75p0116 are functionally the same. users of the m PD750104, m pd750106, or m pd75p0116 should read m pd750108 as referring to m PD750104, m pd750106, or m pd75p0116. 1
2 m pd750108 user's manual 1.1 function overview item function instruction execution ? 4, 8, 16, 64 m s (when the main system clock operates at 1 mhz) time 2, 4, 8, 32 m s (when the main system clock operates at 2 mhz) 122 m s (when the subsystem clock operates at 32.768 khz) internal memory rom 4096 x 8 bits ( m PD750104) 6144 x 8 bits ( m pd750106) 8192 x 8 bits ( m pd750108) 16384 x 8 bits ( m pd75p0116) ram 512 x 4 bits general register when operating in 4 bits: 8 x 4 banks when operating in 8 bits: 4 x 4 banks i/o port 34 8 cmos input pins can incorporate 25 pull-up resistors 18 cmos i/o pins that are specified with the software. four pins can directly drive the led. 8 n-ch open-drain i/o pins can withstand 13 v. eight pins can directly drive can incorporate pull-up resistors that the led. are specified with the mask option. note timer 4 ? 8-bit timer/event counter: 1 channel ? 8-bit timer counter: 1 channel (clock timer output function is provided) ? basic interval timer/watchdog timer: 1 channel ? clock timer: 1 channel serial interface ? three-wire serial i/o mode (switchable between the start lsb and the start msb) ? two-wire serial i/o mode ? sbi mode bit sequential buffer 16 bits clock output ? f , 125, 62.5, 15.6 khz (when the main system clock operates at 1 mhz) f , 250, 125, 31.3 khz (when the main system clock operates at 2 mhz) vectored interrupt external: 3, internal: 4 test input external: 1, internal: 1 system clock oscillator rc oscillator for the main system clock (with external resistor and capacitor) crystal oscillator for the subsystem clock standby function stop/halt mode operating ambient t a = C40?c to +85?c temperature supply voltage v dd = 1.8 to 5.5 v package 42-pin plastic shrink dip (600 mil) 44-pin plastic qfp (10 x 10 mm) note pull-up resistors, specified with the mask option, are not connected to the m pd75p0116.
3 chapter 1 general 1.2 ordering information part number package on-chip rom m PD750104cu-xxx 42-pin plastic shrink dip (600 mil) masked rom m PD750104gb-xxx-3bs-mtx 44-pin plastic qfp (10 x 10 mm) masked rom m pd750106cu-xxx 42-pin plastic shrink dip (600 mil) masked rom m pd750106gb-xxx-3bs-mtx 44-pin plastic qfp (10 x 10 mm) masked rom m pd750108cu-xxx 42-pin plastic shrink dip (600 mil) masked rom m pd750108gb-xxx-3bs-mtx 44-pin plastic qfp (10 x 10 mm) masked rom m pd75p0116cu 42-pin plastic shrink dip (600 mil) one-time prom m pd75p0116gb-3bs-mtx 44-pin plastic qfp (10 x 10 mm) one-time prom remark xxx is a rom code number.
4 m pd750108 user's manual 1.3 differences among m pd750108 subseries products item m PD750104 m pd750106 m pd750108 m pd75p0116 program counter 12 bits 13 bits 14 bits rom (byte) masked rom masked rom masked rom one-time prom 4096 6144 8192 16384 ram (x 4 bits) 512 mask pull-up resistors at incorporated none option ports 4 and 5 (whether to incorporate pull-up resistors can (cannot be be specified.) incorporated.) wait time applied available not available when stop mode is (2 9 /f cc or no wait) note (fixed to 2 9 /f cc .) note released by an interrupt selection to use yes no feedback resistors (whether to use feedback resistors can be (feedback resistors for subsystem clock specified.) are used) pin 6-9 (cu) p33-p30 p33/md3-p30/md0 connection 23-26 (gb) 20 (cu) ic v pp 38 (gb) 38-41 (cu) p43-p40 p43/d3-p40/d0 13-16 (gb) 34-37 (cu) p53-p50 p53/d7-p50/d4 8-11 (gb) others noise immunity and noise radiation vary with the circuit scale and mask layout. note 2 9 /f cc (256 m s at 2 mhz, 512 m s at 1 mhz) caution the noise immunity and noise radiation of the prom model differ from those of the mask rom model. if you replace the prom model with the rom model of the course of experimental production to mass production, perform thorough evaluation by using the cs model (not es model) of the mask rom model. * *
5 chapter 1 general 1.4 block diagram notes 1. the program counter for the m PD750104 consists of 12 bits, 13 bits for the m pd750106 and m pd750108, and 14 bits for the m pd75p0116. 2. the rom capacity depends on the product. 3. ( ) : m pd75p0116 ti0 pto0 pto1 buz si/sb1 so/sb0 sck int0 int1 int2 basic interval timer/ watchdog timer intbt 8-bit timer/event counter 8-bit timer counter watch timer intt1 clocked serial interface intcsi interrupt control program counter note 1 rom note 2 program memory alu cy p00 - p03 bank decode and control general register f cc /2 n clock output control pcl/p22 clock divider clock generator sub main standby control xt1 xt2 cl1 cl2 v ss reset v dd cpu clock ic (v pp ) note 3 sbs p80, p81 p10 - p13 p20 - p23 p30 - p33 p40 - p43 p50 - p53 p60 - p63 p70 - p73 p30/md0 - note 3 p33/md3 int4 kr0 - kr7 intw intt0 tout0 tout0 reset ram data memory 512 x 4 bits sp port 0 port 1 port 2 port 3 port 4 port 5 port 6 port 7 port 8 bit sequential buffer (16) 2 4 4 4 4 4 4 4 4 ( ) p40/d0 - note 3 p43/d3 ( ) p50/d4 - note 3 p53/d7 ( ) f
6 m pd750108 user's manual 1.5 pin configuration (top view) (1) 42-pin plastic shrink dip (600 mil) m PD750104cu-xxx m pd750106cu-xxx m pd750108cu-xxx m pd75p0116cu note connect ic (v pp ) to v dd , keeping the wiring as short as possible. remark ( ) : m pd75p0116. xt1 xt2 reset cl1 cl2 p33 (/md3) p32 (/md2) p31 (/md1) p30 (/md0) p81 p80 p03/si/sb1 p02/so/sb0 p01/sck p00/int4 p13/ti0 p12/int2 p11/int1 p10/int0 ic (v pp ) note v dd v ss p40 (/d0) p41 (/d1) p42 (/d2) p43 (/d3) p50 (/d4) p51 (/d5) p52 (/d6) p53 (/d7) p60/kr0 p61/kr1 p62/kr2 p63/kr3 p70/kr4 p71/kr5 p72/kr6 p73/kr7 p20/pto0 p21/pto1 p22/pcl p23/buz 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22
7 chapter 1 general (2) 44-pin plastic qfp (10 x 10 mm) m PD750104gb-xxx-3bs-mtx m pd750106gb-xxx-3bs-mtx m pd750108gb-xxx-3bs-mtx m pd75p0116gb-3bs-mtx note connect ic (v pp ) to v dd , keeping the wiring as short as possible. remark ( ) : m pd75p0116. p72/kr6 p71/kr5 p70/kr4 p63/kr3 p62/kr2 p61/kr1 p60/kr0 p53 (/d7) p52 (/d6) p51 (/d5) p50 (/d4) p13/ti0 p00/int4 p01/sck p02/so/sb0 p03/si/sb1 p80 p81 p30 (/md0) p31 (/md1) p32 (/md2) p33 (/md3) p73/kr7 p20/pto0 p21/pto1 p22/pcl p23/buz v dd ic (v pp ) note p10/int0 p11/int1 p12/int2 nc nc p43 (/d3) p42 (/d2) p41 (/d1) p40 (/d0) v ss xt1 xt2 reset cl1 cl2 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 33 32 31 30 29 28 27 26 25 24 23 44 43 42 41 40 39 38 37 36 35 34
8 m pd750108 user's manual pin name p00-p03 : port 0 ti0 : timer input 0 p10-p13 : port 1 pto0, 1 : programmable timer output 0, 1 p20-p23 : port 2 buz : buzzer clock p30-p33 : port 3 pcl : programmable clock p40-p43 : port 4 int0, 1, 4 : external vectored interrupt 0, 1, 4 p50-p53 : port 5 int2 : external test input 2 p60-p63 : port 6 cl1, 2 : rc oscillator p70-p73 : port 7 xt1, 2 : subsystem clock oscillation 1, 2 p80-p81 : port 8 nc : no connection kr0-kr7 : key return 0-7 ic : internally connected sck : serial clock v dd : positive power supply si : serial input v ss : ground so : serial output v pp : programming power supply sb0, 1 : serial bus 0, 1 md0-md3 : mode selection 0-3 reset : reset input d0-d7 : data bus 0-7
9 chapter 2 pin functions chapter 2 pin functions 2.1 pin functions of the m pd750108 table 2-1. digital i/o port pins (1/2) input/ also 8 bit upon i/o pin used function circuit output as i/o reset type note 1 p00 input int4 4-bit input port (port0). x input b p01 i/o sck for p01 to p03, built-in pull-up resistors f -a p02 i/o so/sb0 can be connected by software in units of f -b p03 i/o si/sb1 3 bits. m -c p10 input int0 4-bit input port (port1). x input b -c p11 int1 built-in pull-up resistors can be connected p12 int2 by software in units of 4 bits. p13 ti0 for p10/int0, the noise eliminator can be selected. p20 i/o pto0 4-bit i/o port (port2). x input e-b p21 pto1 built-in pull-up resistors can be connected p22 pcl by software in units of 4 bits. p23 buz p30 i/o (md0) note 2 programmable 4-bit i/o port (port3). x input e-b p31 (md1) note 2 i/o can be specified bit by bit. p32 (md2) note 2 built-in pull-up resistors can be connected p33 (md3) note 2 by software in units of 4 bits. notes 1. i/o circuits enclosed in circles have a schmitt-triggered input. 2. ( ): m pd75p0116 2
10 m pd750108 user's manual table 2-1. digital i/o port pins (2/2) input also 8 bit upon i/o pin output used function circuit as i/o reset type note 1 p40 note 2 i/o (d0) note 3 n-ch open-drain 4-bit i/o port (port4). o high level (when m-d withstand voltage is 13 v in open-drain a pull-up resistor (m-e) note 3 p41 note 2 (d1) note 3 mode. is provided) or a pull-up resistor can be provided bit high impedance p42 note 2 (d2) note 3 by bit (mask option) note 4 . data input/output pins for writing/ p43 note 2 (d3) note 3 verifying (lower 4 bits) of program memory (prom). p50 note 2 i/o (d4) note 3 n-ch open-drain 4-bit i/o port (port5). o high level (when m-d withstand voltage is 13 v in open-drain a pull-up resistor (m-e) note 3 p51 note 2 (d5) note 3 mode. is provided) or a pull-up resistor can be provided bit high impedance p52 note 2 (d6) note 3 by bit (mask option) note 4 . data input/output pins for writing/ p53 note 2 (d7) note 3 verifying (higher 4 bits) of program memory (prom). p60 i/o kr0 programmable 4-bit i/o port (port6). o input f -a p61 kr1 i/o can be specified bit by bit. p62 kr2 built-in pull-up resistors can be p63 kr3 connected by software in units of 4 bits. p70 i/o kr4 4-bit i/o port (port7). input f -a p71 kr5 built-in pull-up resistors can be p72 kr6 connected by software in units of p73 kr7 4 bits. p80 i/o 2-bit input port (port8). x input e-b p81 built-in pull-up resistors can be connected by software in units of 2 bits. notes 1. i/o circuits enclosed in circles have a schmitt-triggered input. 2. when pull-up resistors that can be specified with the mask option are not incorporated (when pins are used as n-ch open-drain input ports), the input leak low current increases when an input instruction or bit operation instruction is executed. 3. ( ): m pd75p0116 4. pull-up resistors, specified with the mask option, are not connected to the m pd75p0116. * *
11 chapter 2 pin functions table 2-2. non-port pin functions (1/2) input/ also upon i/o pin output used function reset circuit as type note 1 ti0 input p13 inputs external event pulse to the timer/event counter input b -c pto0 output p20 timer/event counter output input e-b pto1 p21 timer counter output pcl p22 clock output buz p23 arbitrary frequency output (for buzzer or system clock trimming) sck i/o p01 serial clock i/o input f -a so/sb0 p02 serial data output or serial data bus i/o f -b si/sb1 p03 serial data input or serial data bus i/o m -c int4 input p00 edge detection vectored interrupt input b (either a rising or falling edge is detected.) int0 input p10 edge detection vectored interrupt input asynchronous input b -c (the edge to be detected is selectable.) with noise for int0/p10, the noise eliminator eliminator can be selected. selectable int1 p11 asynchronous int2 p12 rising edge detection testable input asynchronous kr0-kr3 input p60-p63 falling edge detection testable input input f -a kr4-kr7 input p70-p73 falling edge detection testable input input f -a cl1 i/o pin for connecting a resistor (r) or capacitor (c) for main system clock oscillation. cl2 output an external clock cannot be input. xt1 input connection pin to a crystal for subsystem clock generation. when an external clock is used, it is input xt2 to xt1, and its inverted signal is input to xt2. xt1 can be used as the 1-bit input (test) pin. reset input system reset input (low-level active) b ic note 2 internally connected. connect to v dd , keeping the wiring as short as possible. v dd positive power supply v ss gnd potential v pp provided only in the m pd75p0116. ? ? program voltage application for program memory (prom) write/verify operation. +12.5 v is applied for prom write/verify operation. connect to v dd , keeping the wiring as short as possible. notes 1. the circuits enclosed in circles have a schmitt-triggered input. 2. used as the v pp pin for the m pd75p0116.
12 m pd750108 user's manual table 2-2. non-port pin functions (2/2) input/ also upon i/o pin output used function reset circuit as type note md0- input p30-p33 provided only in the m pd75p0116. input e-b md3 mode selection for program memory (prom) write/verify operation. d0-d3 i/o p40-p43 provided only in the m pd75p0116. data bus pins for input m-e d4-d7 p50-p53 program memory (prom) write/verify operation. nc ? ? no connection ? ? note the circuits enclosed in circles have a schmitt-triggered input.
13 chapter 2 pin functions 2.2 pin functions 2.2.1 p00-p03 (port0) : input pins also used for int4, sck, so/sb0, and si/sb1 p10-p13 (port1) : input pins also used for int0-int2, and ti0 these are 4-bit input ports, which also have the following functions: (1) port 0 : vectored interrupt input (int4) serial interface i/o (sck, so/sb0, si/sb1) (2) port 1 : vectored interrupt input (int0, int1) edge detection test input (int2) external event pulse input (ti0) for timer/event counter when the serial interface function is used, the operation mode causes the dual-function pin of p0 to become an output pin. schmitt-triggered inputs are used for the pins of port 0 and port 1 to prevent malfunction due to noise. in addition, for p10, the noise eliminator can be selected. (see (3) of section 6.3 for details.) port 0 can be connected with built-in pull-up resistors in units of 3 bits (p01 to p03) by software. port 1 can be connected with built-in pull-up resistors in units of 4 bits (p10 to p13) by software. this is done by manipulating pull-up resistor specification register group a (poga). a reset signal places these pins in input mode. 2.2.2 p20-p23 (port2) : i/o pins also used for pto0, pto1, pcl, and buz p30-p33 (port3) : i/o pins also used for md0-md3 note p40-p43 (port4) : i/o pins also used for d0-d3 note p50-p53 (port5) : n-ch open-drain intermediate withstand voltage (13 v), i/o pins also used for d4-d7 note p60-p63 (port6) : i/o pins also used for kr0-kr3 p70-p73 (port7) : i/o pins also used for kr4-kr7 these are 4-bit i/o ports with output latches, which also have the following functions:
14 m pd750108 user's manual (1) port 2 : timer/event counter output (pto0) timer counter output (pto1) clock output (pcl) arbitrary frequency output (buz) (2) port 3 : mode selection for program memory (prom) write/verify operation (md0-md3) note (3) ports 4 and 5 : data bus for program memory (prom) write/verify operation (d0-d3, d4-d7) note (4) ports 6 and 7 : key interrupt input (kr0-kr3, kr4-kr7) note provided only in the m pd75p0116. ports 4 and 5 are n-ch open-drain intermediate withstand voltage (13 v) ports. the port mode register specifies i/o mode selection for each port. ports 2, 4, 5, and 7 can be specified in units of 4 bits. ports 3 and 6 can be specified bit by bit. ports 2, 3, 6, and 7 can be connected with built-in pull-up resistors, in units of 4 bits, by software. this can be done by manipulating pull-up resistor specification register group a (poga). for ports 4 and 5, the use of built-in pull-up resistors can be specified, bit by bit, with the mask option. however, pull-up resistors, specified with the mask option, are not connected to the m pd75p0116. ports 4 and 5, and ports 6 and 7 can be paired for 8-bit i/o. a reset signal places ports 2, 3, 6, and 7 in input mode (high-impedance), and drives ports 4 and 5 high (when a pull-up resistor, specified with the mask option, is incorporated). or, it causes ports 4 and 5 to enter the high-impedance state. 2.2.3 p80, p81 (port8) these are 2-bit i/o ports with output latches. built-in pull-up resistors can be connected to port 8, in units of 2 bits, by software. this can be done by manipulating pull-up resistor specification register group b (pogb). 2.2.4 ti0: input pin also used for port 1 this is an external event pulse input pin for programmable timer/event counter 0. to use this pin, select the external event pulse input as the count pulse (cp) in the timer/event counter mode register (tm0). a schmitt-triggered input is used for the ti0 pin. see (1) of section 5.5.1 for details.
15 chapter 2 pin functions 2.2.5 pto0, pto1: output pin also used for port 2 these are the output pins of timer/event counter 0 and timer counter 1. square-wave pulses appear on this pin. to output a signal from the timer/event counter and timer counter, clear the output latch to 0, and set bit 2 for port mode register group b to 1. the timer start instruction clears the output of tout flip-flop to 0. see (3) of section 5.5.2 for details. 2.2.6 pcl: output pin also used for port 2 this is the programmable clock output pin. it is used to supply the clock pulse to a peripheral lsi circuit such as a slave microcontroller or a/d converter. a reset signal clears the clock output mode register (clom) to 0, disabling clock output, then the pin is placed in the normal mode to function as a normal port. see section 5.2.4 for details. 2.2.7 buz: output pin also used for port 2 an arbitrary frequency (2.048, 4.096, or 32.768 khz when the subsystem clock operates at 32.768 khz output on this pin can be used for sounding the buzzer or trimming the system clock frequency. this pin is used also as the p23 pin, and can be used only when bit 7 (wm.7) of the clock mode register (wm) is set to 1. a reset signal clears wm.7 to 0, and places this pin in the normal operation mode as a general port. see section 5.4.2 for details. 2.2.8 sck, so/sb0, si/sb1: i/o pins also used for port 0 these are i/o pins for serial interface. they operate according to the setting of the serial operation mode registers (csim). when three-wire serial i/o mode is selected, sck functions as cmos i/o, so functions as cmos output, and si functions as cmos input. when two-wire serial i/o mode is selected, sck functions as cmos i/o, and sb1 (sb0) functions as n-ch open-drain i/o. a reset signal stops serial interface operation and places these pins in the input port mode. a schmitt-triggered input is used for each pin. see section 5.6 for details. 2.2.9 int4: input pin also used for port 0 int4 is an external vectored interrupt input pin, which is rising edge active as well as falling edge active. when a signal applied to this pin goes from low to high or from high to low, the interrupt request flag is set. int4 is an asynchronous input, and can accept a signal with some high level width or low level width regardless of what the cpu clock is. the int4 pin can also be used to release the stop and halt modes. a schmitt-triggered input is used for this pin.
16 m pd750108 user's manual 2.2.10 int0, int1: input pins also used for port 1 these are the edge detection vectored interrupt input pins. for int0, the noise eliminator can be selected. the edge to be detected can be selected using the edge detection mode registers (im0, im1). (1) int0 (bits 0 and 1 of im0) (a) rising edge active (b) falling edge active (c) both rising and falling edges active (d) external interrupt signal input disabled (2) int1 (bit 0 of im1) (a) rising edge active (b) falling edge active int0 and int1 are asynchronous inputs, and can accept a signal with some high level width regardless of what the cpu clock is. int0 can be provided with the noise eliminator function by software, and change the sampling clock that eliminates the noise at two levels. in this case, the width of the signal received by the cpu operation clock varies. a reset input clears im0 and im1 to 0, selecting rising edge active. the int0 and int1 pins can be used to release stop and halt modes. when the noise eliminator is selected, however, the int0 pin cannot be used to release stop and halt modes. schmitt-triggered inputs are used for the int0 and int1 pins. 2.2.11 int2: input pin also used for port 1 this is a rising edge active, external test input pin. when int2 is selected with the edge detection mode register (im2), or when the signal applied to this pin goes high, the internal test flag (irq2) is set. int2 is an asynchronous input, and can accept a signal with some high level width regardless of the operating clock of the cpu. a reset signal clears im2 to 0. in this case, the test flag (irq2) is set by a rising edge on the int2 pin. the int2 pin can also be used to release the stop and halt modes. a schmitt-triggered input is used for this pin.
17 chapter 2 pin functions 2.2.12 kr0-kr3: input pins also used for port 6 kr4-kr7: input pins also used for port 7 kr0 to kr7 are key interrupt input pins. an interrupt is caused when parallel falling edges are detected on them. an interrupt source can be selected from among kr0-kr7, kr2-kr7, or kr4-kr7 by means of the edge detection mode register (im2). a reset signal places these pins in the port 6 and 7 input modes. 2.2.13 cl1, cl2 these pins are used for connection to a resistor (r) and capacitor (c) for main system clock generation. an external clock cannot be input. rc oscillation 2.2.14 xt1, xt2 these pins are used for connection to a crystal for subsystem clock oscillation. an external clock can also be applied. (a) crystal oscillation (b) external clock remark if the subsystem clock is not to be used, see (6) of section 5.2.2 . c r cl1 cl2 v ss pd750108 v ss xt1 xt2 crystal pd750108 (standard frequency: 32.768 khz) xt1 xt2 external clock pd750108
18 m pd750108 user's manual 2.2.15 reset this is the pin for active-low reset input. the reset input is asynchronous. when a signal with certain low level width is applied to the pin, a reset signal is generated to cause a system reset, which has priority over any other operations. the reset signal is used for normal cpu initialize/start operation, and is also used to release stop or halt mode. a schmitt-triggered input is used for the reset input pin. 2.2.16 v dd this is the positive power supply pin. 2.2.17 v ss this is the ground pin. 2.2.18 ic (for the m PD750104, m pd750106, and m pd750108 only) the internally connected (ic) pin is used to set the m pd750108 to test mode for inspection prior to shipping. in normal operation, connect the ic pin to the v dd pin, keeping the writing as short as possible. when the wiring between the ic pin and the v dd pin is too long, or noise is generated on the ic pin, a potential difference may occur between the ic pin and the v dd pin. this may cause your program to malfunction. connect the ic pin to the v dd pin, keeping the wiring as short as possible. 2.2.19 v pp (for the m pd75p0116 only) this is a program voltage input pin for program memory (one-time prom) write/verify operation. for normal use, connect this pin to v dd , keeping the wiring as short as possible (shown above). +12.5 v is applied for prom write/verify operation. 2.2.20 md0-md3 (for the m pd75p0116 only) md0 to md3 select a mode for program memory (one-time prom) write/verify operation. 2.2.21 d0-d7 (for the m pd75p0116 only) these are the data bus pins for the program memory (one-time prom) write/verify operation. v dd v dd ic (v pp ) keep the wiring as short as possible *
19 chapter 2 pin functions 2.3 pin input/output circuits figure 2-1 shows schematic diagrams of the i/o circuitry of the m pd750108. figure 2-1. pin input/output circuits (1/2) type b-c type a type d type b cmos input buffer v dd in p-ch n-ch schmitt trigger input with hysteresis in p.u.r.: pull-up resistor in p-ch p.u.r. enable p.u.r. v dd push-pull output which can be set to high-impedance output (off for both p-ch and n-ch) v dd p-ch n-ch out data output disable
20 m pd750108 user's manual figure 2-1. pin input/output circuits (2/2) type e-b type m-c type f-a type f-b type m-e * type m-d * p.u.r.: pull-up resistor p.u.r. v dd p.u.r. enable p-ch in/out data output disable type d type a p.u.r.: pull-up resistor p.u.r. v dd p.u.r. enable p-ch in/out data output disable type d type b p.u.r.: pull-up resistor v dd p-ch n-ch in/out v dd p-ch p.u.r. p.u.r. enable output disable (p-ch) data output disable output disable (n-ch) p.u.r.: pull-up resistor n-ch p.u.r. data output disable p.u.r. enable v dd p-ch in/out n-ch (withstand voltage of +13 v) in/out p-ch v dd note pull-up resistor that operates only when an input instruction is executed with no pull-up resistor contained by mask option. (current flows from v dd to the pins when at low level) data output disable input instruction (withstand voltage of +13 v) p.u.r. note voltage limitation circuit p.u.r. (mask option) v dd n-ch (withstand voltage of +13 v) in/out p-ch v dd note pull-up resistor that operates only when an input instruction is executed. (current flows from v dd to the pins when at low level) data output disable input instruction (withstand voltage of +13 v) p.u.r. note voltage limitation circuit
21 chapter 2 pin functions 2.4 connection of unused pins table 2-3. connection of unused pins pin name recommended connection p00/int4 to be connected to v ss or v dd p01/sck to be connected to v ss or v dd through p02/so/sb0 a resistor p03/si/sb1 to be connected to v ss p10/int0-p12/int2 to be connected to v ss or v dd p13/ti0 p20/pto0 input state: to be connected to v ss or p21/pto1 v dd through a resistor p22/pcl output state: to be left open p23/buz p30(/md0)-p33(/md3) note 1 p40-p43 to be connected to v ss . (a pull-up resistor, specified with the mask option, must not be p50-p53 connected.) p60/kr0-p63/kr3 input state: to be connected to v ss or p70/kr4-p73/kr7 v dd through a resistor p80-p81 output state: to be left open xt1 note 2 to be connected to v ss or v dd xt2 note 2 to be left open ic (v pp ) note 1 to be always connected directly to v dd notes 1. ( ): m pd75p0116 2. when the subsystem clock is not to be used, select sos.0 = 1 (the built-in feedback resistor will not be used). *
22 m pd750108 user's manual [memo]
23 chapter 3 features of the architecture and memory map chapter 3 features of the architecture and memory map the 75xl series architecture of the m pd750108 has the following features: internal ram of up to 4k words x 4 bits (12-bit address) peripheral hardware expansibility to provide these features, the following are used: (1) data memory bank structure (2) general register bank structure (3) memory-mapped i/o this chapter explains these topics. 3.1 data memory bank structure and addressing modes 3.1.1 data memory bank structure in the m pd750108, addresses 000h to 1ffh in data memory space are assigned to static ram (512 words x 4 bits), and addresses f80h to fffh are assigned to peripheral hardware (such as i/o ports and timers). to address a 12-bit location in this data memory space (4k x 4 bits), the m pd750108 uses such a memory bank structure that the low-order eight bits are specified with an instruction directly or indirectly, and the high- order four bits are used to specify a memory bank. to specify a memory bank (mb), two hardware items are incorporated: memory bank enable flag (mbe) memory bank select register (mbs) the mbs is a register used to select a memory bank, and the register can be set to 0, 1, or 15. the mbe is a flag used to determine whether the memory bank selected using the mbs is valid. as shown in figure 3-1, when the mbe is set to 0, a certain memory bank is always selected regardless of the setting of the mbs. when the mbe is set to 1, memory bank selection depends on the setting of the mbs, thus enabling data memory space expansion. in addressing data memory space, the mbe is usually set to 1 (mbe = 1), and data memory in the memory bank specified in the mbs is operated. however, the mbe = 0 mode or mbe = 1 mode can be selected for each step of processing for more efficient programming. 3
24 m pd750108 user's manual applicable program processing effect mbe = 0 mode ? interrupt processing mbs save/restoration becomes unnecessary. ? processing that repeats internal mbs modification becomes unnecessary. hardware and static ram operations ? subroutine processing mbs save/restoration becomes mbe = 1 mode ? usual program processing figure 3-1. use of mbe = 0 mode and mbe = 1 mode the contents of the mbe are automatically saved or restored at the time of subroutine processing, so that the mbe can be freely modified during subroutine processing. in interrupt processing, the mbe is automatically saved or restored, and when interrupt processing is started, the contents of the mbe can be specified for the interrupt processing by setting the interrupt vector table. this speeds up interrupt processing. the setting of the mbs can be modified for subroutine processing or interrupt processing by saving or restoring the mbs with the push or pop instruction. the mbe is set using the set1 or clr1 instruction. the mbs is set using the sel instruction. examples 1. the mbe is cleared, and a fixed memory bank is used. clr1 mbe ; mbe mbe = 0 mbe = 1 clr1 mbe mbe = 0 ret ; mbe = 0 is to be set in the vector table. mbe = 0 reti internal hardware and static ram operations are repeated.
25 chapter 3 features of the architecture and memory map 3.1.2 data memory addressing modes with the architecture of the m pd750108, seven addressing modes summarized in figure 3-2 and table 3-1 are available to address data memory space efficiently for each bit length of data to be processed. these addressing modes enable more efficient programming. (1) 1-bit direct addressing (mem.bit) in this addressing mode, the operand of an instruction can directly specify any bit in the entire data memory space. a particular memory bank (mb) is always used in this addressing mode. in the mbe = 0 mode, when an address from 00h to 7fh is specified in the operand, memory bank 0 (mb = 0) is always used. when an address from 80h to ffh is specified, memory bank 15 (mb = 15) is always used. accordingly, both the data area ranging from 000h to 07fh and the peripheral hardware area ranging from f80h to fffh can be addressed in the mbe = 0 mode. in the mbe = 1 mode, mb = mbs, and specifiable data memory space can be expanded. this addressing mode can be applied to four instructions: bit set and reset instructions (set1 and clr1), and bit test instructions (skt and skf). example flag1 is set, flag2 is reset, and whether flag3 is zero is tested. flag1 equ 03fh.1 ; bit 1 at address 3fh flag2 equ 087h.2 ; bit 2 at address 87h flag3 equ 0a7h.0 ; bit 0 at address a7h set1 mbe ; mbe 26 m pd750108 user's manual figure 3-2. data memory organization and addressing range of each addressing mode remark C : don't care addressing mode memory bank enable flag area for general register data area static ram (memory bank 0) data area static ram (memory bank 1) not provided peripheral hardware area (memory bank 15) 000h 01fh 020h 07fh 0ffh 100h 1ffh f80h fc0h fffh mem mem.bit mbe =0 mbe =1 mbe =0 mbe =1 @hl @h+mem.bit @de @dl stack address- ing fmem.bit pmem.@l mbs =15 mbs =15 mbs =0 mbs =0 mbs =1 mbs =1 sbs =0 sbs =1
27 chapter 3 features of the architecture and memory map table 3-1. addressing modes addressing mode representation specified address format 1-bit direct mem.bit bit specified by bit at the address specified by mb and mem. addressing ? when mbe = 0 and mem = 00h-7fh, mb = 0 mem = 80h-ffh, mb = 15 ? when mbe = 1, mb = mbs 4-bit direct mem address specified by mb and mem. addressing ? when mbe = 0 and mem = 00h-7fh, mb = 0 mem = 80h-ffh, mb = 15 ? when mbe = 1, mb = mbs 8-bit direct address specified by mb and mem (mem: even address). addressing ? when mbe = 0 and mem = 00h-7fh, mb = 0 mem = 80h-ffh, mb = 15 ? when mbe = 1, mb = mbs 4-bit register @hl address specified by mb and hl. indirect @hl+ in this case, mb = mbembs addressing @hlC hl+ automatically increments the l register after addressing. hlC automatically decrements the l register after addressing. @de address specified by de in memory bank 0 @dl address specified by dl in memory bank 0 8-bit register @hl address specified by mb and hl. (contents of the l register is indirect an even address.) addressing in this case, mb = mbembs bit fmem.bit bit specified by bit at the address specified by fmem. manipulation in this case, addressing fmem = fb0h-fbfh (interrupt-related hardware) ff0h-fffh (i/o ports) pmem.@l bit specified by the low-order two bits of the l register at the address specified by the high-order 10 bits of pmem and the high-order two bits of the l register. in this case, pmem = fc0h-fffh @h+mem.bit bit specified by bit at the address specified by mb, h, and the low- order four bits of mem. in this case, mb = mbembs stack addressing address specified by the sp in memory bank 0 or 1 selected by the sbs
28 m pd750108 user's manual (2) 4-bit direct addressing (mem) in this addressing mode, the operand of an instruction directly specifies any area in the data memory space in units of four bits. as with the 1-bit direct addressing mode, in the mbe = 0 mode, a fixed space consisting of the static ram area ranging from 000h to 07fh and the peripheral hardware area ranging from f80h to fffh can be addressed. in the mbe = 1 mode, mb = mbs, and specifiable data memory space can be expanded to the entire space. this addressing mode can be applied to the mov, xch, incs, in, and out instructions. caution less efficient program processing results if data associated with an i/o port is stored in the static ram area of bank 1 as in example 1. the modification of the mbs, as contained in example 2, becomes unnecessary in the programming if data associated with an i/o port is stored at addresses 00h to 7fh of bank 0. examples 1 . the data contained in buff is output on port 5. buff equ 11ah ; buff located at address 11ah set1 mbe ; mbe 29 chapter 3 features of the architecture and memory map example 2. eight-bit data is latched into the serial interface shift register (sio), and the transfer data is set at the same time. sel mb15 ; mbs (sio) (4) 4-bit register indirect addressing (@rpa) in this addressing mode, the pointer (general register pair) specified in the operand of an instruction indirectly specifies a data memory space in units of four bits. there are three types of data pointers. one is the hl register pair, which can specify any area in the data memory space when mb = mbembs is specified. the other two are the de register pair and dl register pair, with which memory bank 0 is always used regardless of how the mbe and mbs are specified. more efficient programming is possible by selecting a data pointer according to a data memory bank to be used. when the hl register pair is specified, the l register can be incremented or decremented by one in the automatic increment or automatic decrement mode each time an instruction is executed, thus simplifying the program step. example the data at 50h to 57h is transferred to 110h to 117h. data1 equ 57h data2 equ 117h set1 mbe ; mbe (hl), l 30 m pd750108 user's manual example 2. the data memory of 00h to ffh is cleared to 0. clr1 rbe clr1 mbe mov xa,#00h mov hl,#04h loop: mov @hl,a ; (hl) 31 chapter 3 features of the architecture and memory map (5) 8-bit register indirect addressing (@hl) in this addressing mode, the data pointer (hl register pair) indirectly specifies any area in the data memory space in units of eight bits. the 4-bit data at the address determined with bit 0 of the data pointer (bit 0 of the l register) set to 0 and the 4-bit data at the address incremented by 1 are processed as a pair on an 8-bit basis with the 8-bit accumulator (xa register pair). a memory bank is specified in the same way as the 4-bit register indirect addressing with the hl register specified. in this case, mb = mbembs. this addressing mode can be applied to the mov, xch, and ske instructions. examples 1. a comparison is made to determine whether the value of the count register (t0) of timer/ event counter 0 is equal to the data at addresses 30h and 31h. data equ 30h clr1 mbe mov hl,#data mov xa,t0 ; xa 32 m pd750108 user's manual (a) specific address bit direct addressing (fmem.bit) in this addressing mode, peripheral equipment that frequently performs bit manipulations involving, for example, i/o ports and interrupt flags, can be processed at all times regardless of memory bank setting. accordingly, the data memory addresses that allow this addressing mode to be used are ff0h to fffh where i/o ports are mapped, and fb0h to fbfh where interrupt-related hardware is mapped. hardware mapped to these data memory areas can freely perform bit manipulations in the direct addressing mode at any time regardless of mbs and mbe setting. examples 1. value input to p02 is inverted, and the result is output on p33. mov1 cy, port0.2 not1 cy mov1 port3.3, cy 2. the timer 0 interrupt request flag (irqt0) is tested. the request flag, if set, is cleared, and p63 is reset. sktclr irqt0 ; irqt0 = 1? br no ; no clr1 port6.3 ; yes 3. if both p30 and p41 are set to 1, p53 is reset. mov1 cy, port3.0 ; cy 33 chapter 3 features of the architecture and memory map (b) specific address bit register indirect addressing (pmem.@l) in this addressing mode, the bits of peripheral hardware i/o ports are indirectly specified using a register to allow continuous manipulations. this addressing mode can be applied to data memory addresses fc0h to fffh. in this addressing mode, the high-order 10 bits of a 12-bit data memory address is directly specified in the operand, and the low-order two bits and bit address are indirectly specified using the l register. thus the use of the l register enables 16 bits (four ports) to be continuously manipulated. this addressing mode again enables bit manipulation regardless of mbe and mbs setting. example pulses are output on the bits in the order from port 4 to port 7. mov l,#0 loop: set1 port4.@l ; bits (l 1-0 ) of ports 4 to 7 34 m pd750108 user's manual (c) specific 1-bit direct addressing (@h+mem.bit) this addressing mode enables any bit in the data memory space to be manipulated. in this addressing mode, the high-order four bits of the data memory address in the memory bank specified by mb = mbembs are indirectly specified using the h register, and the low-order four bits and bit address are directly specified in the operand. this addressing mode enables a wide variety of manipulations for each bit in the entire data memory space. example bit 2 at address 32h (flag3) is reset if both bit 3 at address 30h (flag1) and bit 0 at address 31h (flag2) are set to 0 or 1. flag1 equ 30h.3 flag2 equ 31h.0 flag3 equ 32h.2 sel mb0 mov h,#flag1 shr 6 mov1 cy, @h+flag1 ; cy 35 chapter 3 features of the architecture and memory map (7) stack addressing this addressing mode is used for save/restoration operation in interrupt processing or subroutine processing. in this addressing mode, the address indicated by the stack pointer (8 bits) of data memory bank 0 is specified. this addressing mode can be used for register save/restoration operation using the push or pop instruction as well as save/restoration operation in interrupt and subroutine processing. examples 1. a register is saved and restored in subroutine processing. sub: push xa push hl push bs ; save mbs and rbs pop bs pop hl pop xa ret 2. the contents of the hl register pair are transferred to the de register pair. push hl pop de ; de 36 m pd750108 user's manual 3.2 general register bank configuration the m pd750108 contains four register banks, each consisting of eight general registers: x, a, b, c, d, e, h, and l. these registers are mapped to addresses 00h to 1fh in memory bank 0 of the data memory (see figure 3-5 ). to specify a general register bank, a register bank enable flag (rbe) and a register bank select register (rbs) are contained. the rbs is a register used to select a register bank, and the rbe is a flag used to determine whether a register bank selected using the rbs is to be enabled. the register bank (rb) enabled at instruction execution is determined as rb = rberbs table 3-2. register bank to be selected with the rbe and rbs remark x: dont care the contents of the rbe are automatically saved or restored at the beginning or end of subroutine processing, so that the rbe can be freely modified during subroutine processing. in interrupt processing, the rbe is automatically saved or restored, and when interrupt processing is started, the contents of the rbe can be specified for the interrupt processing by setting the interrupt vector table. therefore, as indicated in table 3-3, by selecting a register bank depending on whether the processing is normal or interrupt, the general register need not be saved and restored for the level-one interrupt processing, and only the rbs needs to be saved and restored for the level-two interrupt processing, thus speeding up interrupt processing. table 3-3. recommended use of register banks with normal routines and interrupt routines normal processing use register banks 2 and 3 with rbe = 1. level-one interrupt processing use register bank 0 with rbe = 0. level-two interrupt processing use register bank 1 with rbe = 1. (in this case, the rbs needs to be saved and restored.) multiple (triple or more) interrupt processing save and restore the registers with push or pop. bank 0 is always selected. rbe rbs 3210 000xx bank 0 is selected. 00 bank 1 is selected. 100 01 bank 2 is selected. 10 bank 3 is selected. 11 register bank always 0
37 chapter 3 features of the architecture and memory map figure 3-4. example of register bank selection the setting of the rbs can be modified for subroutine processing or interrupt processing by saving or restoring the rbs with the push or pop instruction. the rbe is set using the set1 or clr1 instruction. the rbs is set using the sel instruction. example set1 rbe ; rbe ; rbe = 0 in the vector table rb = 2 sel rb2 rb = 0 rb = 1 reti ; rbe = 1 in the vector table push bs sel rb1 rb = 0 pop bs reti pop rp reti push rp ; rbe = 0 in the vector table
38 m pd750108 user's manual (2) when used as an 8-bit register when the general register area is used on an 8-bit basis, the register pairs in the register bank specified by rberbs can be specified as xa, bc, de, and hl as shown in figure 3-6, and the register pairs in the register bank that has the inverted value of bit 0 of the register bank (rb) can be specified as xa, bc, de, and hl, thus providing up to eight 8-bit registers. the xa register pair functions as an 8-bit accumulator which performs transfers, arithmetic/logical operations, comparisons, and increments/ decrements of 8-bit data. the other register pairs perform transfers, arithmetic/logical operations, comparisons, and increments/decrements with the accumulator. the hl register pair functions mainly as a data pointer, and the de and dl register pairs function as an auxiliary data pointer. examples 1. incs hl ; hl 39 chapter 3 features of the architecture and memory map figure 3-5. general register configuration (4-bit processing) x h d b x h d b x h d b x h d b 01h 03h 05h 07h 09h 0bh 0dh 0fh 11h 13h 15h 17h 19h 1bh 1dh 1fh a l e c a l e c a l e c a l e c 00h 02h 04h 06h 08h 0ah 0ch 0eh 10h 12h 14h 16h 18h 1ah 1ch 1eh register bank 0 (rberbs = 0) register bank 1 (rberbs = 1) register bank 2 (rberbs = 2) register bank 3 (rberbs = 3)
40 m pd750108 user's manual figure 3-6. general register configuration (8-bit processing) xa hl de bc xa hl de bc 00h 02h 04h 06h 08h 0ah 0ch 0eh when rberbs = 0 xa hl de bc xa hl de bc 00h 02h 04h 06h 08h 0ah 0ch 0eh when rberbs = 1 xa hl de bc xa hl de bc 10h 12h 14h 16h 18h 1ah 1ch 1eh when rberbs = 2 xa hl de bc xa hl de bc 10h 12h 14h 16h 18h 1ah 1ch 1eh when rberbs = 3
41 chapter 3 features of the architecture and memory map 3.3 memory-mapped i/o the m pd750108 employs memory-mapped i/o, which maps peripheral hardware such as timers and i/o ports to addresses f80h to fffh in data memory space as shown in figure 3-2. this means that there is no particular instruction to control peripheral hardware, but all peripheral hardware is controlled using memory manipulation instructions. (some mnemonics for hardware control are available to make programs readable.) to manipulate peripheral hardware, the addressing modes listed in table 3-4 can be used. table 3-4. addressing modes applicable to peripheral hardware operation applicable addressing mode applicable hardware bit direct addressing mode specifying mem.bit with all hardware manipulation mbe = 0 (mbe = 1, mbs = 15) allowing bit manipulation direct addressing mode specifying fmem.bit regardless of ist1, ist0, mbe, rbe, mbe and mbs setting iexxx, irqxxx, portn.x indirect addressing mode specifying pmem.@l regardless of bsbn.x mbe and mbs setting portn.x 4-bit direct addressing mode specifying mem with all hardware allowing 4-bit manipulation mbe = 0 or (mbe = 1, mbs = 15) manipulation register indirect addressing mode specifying @hl with (mbe = 1, mbs = 15) 8-bit direct addressing mode specifying mem (even address) with all hardware allowing 8-bit manipulation mbe = 0 or (mbe = 1, mbs = 15) manipulation register indirect addressing mode specifying @hl (with the l register containing an even number) with mbe = 1 and mbs = 15 figure 3-7 summarizes the i/o map of the m pd750108. the items in the figure have the following meanings: symbol : name representing incorporated hardware, which can be coded in the operand field of an instruction r/w : indicates whether the hardware allows read/write operation. r/w : both read and write operations possible r : read only w : write only number of manipulatable bits: indicates the number of bits that can be processed at a time in hardware manipulation o : bit manipulation is possible in units of the indicated number of bits (1, 4, or 8 bits). d : particular bits can be manipulated. for these bits, see remarks. e : bit manipulation is impossible in units of the indicated number of bits (1, 4, or 8 bits). bit manipulation addressing: bit manipulation addressing applicable in hardware bit manipulation
42 m pd750108 user's manual figure 3-7. m pd750108 i/o map (1/5) notes 1. can be manipulated separately as the rbs and mbs in 4-bit units. can also be manipulated as the bs in 8-bit units. use sel mbn and sel rbn instructions to write data to the mbs and rbs respectively. use a push or pop instruction to write data to the bs. 2. wdtm: watchdog timer enable flag (w); cannot be cleared by an instruction. f80h f82h f83h f85h f86h f8bh f98h address b3 b2 b1 b0 hardware name (symbol) r/ w 1 bit 4 bits 8 bits remarks number of bits that can be manipulated r/ w r CC C C C C note 1 bit manipulation addressing stack pointer (sp) register bank selection register (rbs) bank selection register (bs) memory bank selection register (mbs) basic interval timer mode register (btm) basic interval timer (bt) wdtm bit 0 is fixed to 0. only bit 3 can be manipulated. w w r C CC CC mem.bit mem.bit C clock mode register (wm) r/ w C CC (r) C mem.bit only bit 3 can be tested. f84h stack bank selection register (sbs) r/w C mem.bit C note 2
43 chapter 3 features of the architecture and memory map figure 3-7. m pd750108 i/o map (2/5) notes 1. toe0: timer/event counter output enable flag (w) 2. toe1: timer counter output enable flag (w) fa0h fa2h fa4h fa6h fa8h fach address b3 b2 b1 b0 hardware name (symbol) r/ w 1 bit 4 bits 8 bits remarks number of bits that can be manipulated bit manipulation addressing timer/event counter mode register (tm0) timer/event counter modulo register (tmod0) r/ w C C C C CC mem.bit C toe0 note 1 wCC mem.bit timer/event counter count register (t0) r C C C faah toe1 note 2 wCC mem.bit r/ w timer counter mode register (tm1) C CC mem.bit C timer counter count register (t1) r C C C faeh timer counter modulo register (tmod1) r/w C C C bit write manipu- lation is enabled only for bit 3. bit write manipu- lation is enabled only for bit 3. r/ w (w) (r/w) (w) (r/w)
44 m pd750108 user's manual figure 3-7. m pd750108 i/o map (3/5) notes 1. not registered as a reserved word. 2. use the cy manipulation operation to write data to the cy. 3. only bit 3 can be manipulated by an ei/di instruction. 4. bits 3 and 2 can be manipulated bit by bit by a stop/halt instruction. remarks 1. iexxx : interrupt enable flag 2. irqxxx : interrupt request flag (r/ w) fb0h fb2h fb3h fb4h fb5h fb7h fb8h fbch fbdh fc0h fc2h address b3 b2 b1 b0 hardware name (symbol) r/ w 1 bit 4 bits 8 bits remarks number of bits that can be manipulated r/ w C C note 3 bit manipulation addressing int0 edge detection mode register (im0) manipulation in 8-bit units is enabled only for reading. r/ w r/ w r/ w r/ w (r) C fmem.bit C bit sequential buffer 3 (bsb3) ist1 program status word (psw) cy note 1 (r) (r/ w) inta register (inta) intc register (intc) inte register (inte) intf register (intf) intg register (intg) inth register (inth) C C r/ w r/ w fmem.bit interrupt priority select register (ips) processor clock control register (pcc) int1 edge detection mode register (im1) bits 3, 2, and 1 are fixed to 0. r/ w C C fb6h int2 edge detection mode register (im2) bits 3 and 2 are fixed to 0. r/ w bits 2 and 1 are fixed to 0. fbah r/ w r/ w C C C fbeh fbfh r/ w r/ w C C C ist0 sk2 note 1 mbe sk1 note 1 rbe sk0 note 1 ie4 iet1 ie1 irq4 irqt1 irq1 iebt iet0 ie0 irqbt irqt0 irq0 iecsi iew ie2 irqcsi irqw irq2 fc1h fc3h r/ w r/ w r/ w r/ w bit sequential buffer 2 (bsb2) bit sequential buffer 1 (bsb1) bit sequential buffer 0 (bsb0) mem.bit pmem.@l system clock control register (scc) note 4 (r/w) C fcfh r/ w sub-oscillator control register (sos) C CC note 2 CC C C C C
45 chapter 3 features of the architecture and memory map figure 3-7. m pd750108 i/o map (4/5) notes 1. not registered as a reserved word. 2. whether a bit can be read or written depends on the bit. fd0h fdch fdeh address b3 b2 b1 b0 hardware name (symbol) r/ w 1 bit 4 bits 8 bits remarks number of bits that can be manipulated bit manipulation addressing r/w C C C r/w C C C C C r/w clock output mode register (clom) C fe2h whether this location is read- or write- accessible de- pends on the bit. fe0h fe4h note 2 fe6h fe8h fech r/w (pm33) note 1 port mode register group a (pmga) (pm63) note 1 (pm32) note 1 (pm62) note 1 (pm31) note 1 (pm61) note 1 (pm30) note 1 (pm60) note 1 r/w C port mode register group b (pmgb) (pm7) note 1 (pm2) note 1 C C (pm5) note 1 C CC (pm4) note 1 feeh r/w C port mode register group c (pmgc) C C C C CCC C (pm8) note 1 C CCCC (po3) note 1 (po2) note 1 (po1) note 1 (po0) note 1 (po8) note 1 (po7) note 1 (po6) note 1 pull-up resistor register group a (poga) pull-up resistor register group b (pogb) cmdd sbi control register (sbic) bsye reld ackd cmdt acke relt ackt r/ w csie coi wup r/ w r/ w C C C serial i/o shift register (sio) r/w C C C slave address register (sva) C C C C C C C C C serial operation mode register (csim) C C (r) (w) C C mem.bit C mem.bit C
46 m pd750108 user's manual figure 3-7. m pd750108 i/o map (5/5) notes 1. bit 1 can be read or written only in serial operation enable mode. it can be read when four-bit manipulation is performed. 2. kr0 to kr7 can be read (r) bit by bit. when inputting 4 bits at a time, specify port6 or port7. ff0h ff1h ff2h ff3h ff4h ff5h ff6h note 2 ff7h note 2 ff8h address b3 b2 b1 b0 hardware name (symbol) r/ w 1 bit 4 bits 8 bits remarks number of bits that can be manipulated r/w r r/ w r/ w r/ w r/ w r/ w r/ w r/ w bit manipulation addressing fmem.bit pmem.@l C C port 0 port 1 port 2 port 3 port 4 port 5 port 8 kr3 kr2 kr1 (port0) (port1) (port2) (port3) (port4) (port5) (port8) kr0 port 6 kr7 kr6 kr5 kr4 port 7 (port7) (port6) sckp (r) (r/ w) (r) note 1 C
47 chapter 4 internal cpu functions chapter 4 internal cpu functions 4.1 mk i mode/mk ii mode switch functions 4.1.1 differences between mk i mode and mk ii mode the cpu of the m pd750108 subseries has two modes (mk i mode and mk ii mode) and which mode is used is selectable. bit 3 of the stack bank selection register (sbs) determines the mode. mk i mode: this mode has the upward compatibility with the 75x series. it can be used in the 75xl cpus having a rom of up to 16kb. mk ii mode: this mode is not compatible with the 75x series. it can be used in all 75xl cpus, including those having a rom of 16kb or more. table 4-1 shows the differences between mk i mode and mk ii mode. table 4-1. differences between mk i mode and mk ii mode mk i mode mk ii mode number of stack bytes in a subroutine instruction 2 bytes 3 bytes bra !addr1 instruction not supported supported calla !addr1 instruction call !addr instruction 3 machine cycles 4 machine cycles callf !faddr instruction 2 machine cycles 3 machine cycles caution for the 75x and 75xl series, mk ii mode supports a program area of more than 16k bytes. this mode is provided to maintain software compatibility with products requiring a program memory of more than 16k bytes. when mk ii mode is selected, each use area of the stack byte when the subroutine call instruction is executed will be increased by one byte compared to mk i mode. when the call !addr or callf !faddr instruction is used, the machine cycle will need one more machine cycle. therefore, mk i mode is recommended for those applications where emphasis is placed on ram efficiency or speed rather than software compatibility. 4 *
48 m pd750108 user's manual 4.1.2 setting of the stack bank selection register (sbs) the mk i mode and mk ii mode are switched by stack bank selection register. figure 4-1 shows the register configuration. the stack bank selection register is set with a 4-bit memory operation instruction. to use the cpu in mk i mode, initialize the register to 100xb note at the beginning of the program. to use the cpu in mk ii mode, initialize it to 000xb note . note specify the desired value in x. figure 4-1. stack bank selection register format caution the cpu operates in mk i mode after the reset signal is issued, because bit 3 of sbs is set to 1. set bit 3 of sbs to 0 (mk ii mode) to use the cpu in mk ii mode. sbs0 sbs1 sbs2 sbs3 0 1 2 3 f84h address sbs symbol 0 0 0 1 memory bank 0 memory bank 1 other settings are inhibited 0 1 mk ii mode mk i mode mode switching designation bit 2 must be set to 0 stack area designation
49 chapter 4 internal cpu functions 4.2 program counter (pc): 12 bits ( m PD750104) 13 bits ( m pd750106 and m pd750108) 14 bits ( m pd75p0116) the program counter is a binary counter which retains the address data of the program memory. the program counter consists of 12 bits in the m PD750104 (see figure 4-2(a) ), 13 bits in the m pd750106 and m pd750108 (see figure 4-2(b) ), and 14 bits in the m pd75p0116 (see figure 4-2(c) ). figure 4-2. program counter organization (a) m PD750104 (b) m pd750106 and m pd750108 (c) m pd75p0116 usually, each time an instruction is executed, the program counter is automatically incremented according to the number of bytes in the instruction. when a branch instruction (br, bra, brcb) is executed, immediate data indicating the branch destination and the contents of a register pair are set in all or some bits of the program counter. when a subroutine call instruction (call, calla, callf) is executed, or a vectored interrupt occurs, the current contents of the program counter (already incremented return address for fetching the next instruction) are saved in the stack memory (data memory indicated by the stack pointer), then the jump destination address is loaded. when a return instruction (ret, rets, reti) is executed, the contents of the stack memory are set in the program counter. when the reset signal is issued, the program counter is initialized to the contents of the program memory at addresses 000h and 001h. the program can be started from any address according to the contents. m PD750104 : pc 11 -pc 8 50 m pd750108 user's manual 4.3 program memory (rom): 4096 words x 8 bits ( m PD750104: masked rom) 6144 words x 8 bits ( m pd750106: masked rom) 8192 words x 8 bits ( m pd750108: masked rom) 16384 words x 8 bits ( m pd75p0116: one-time prom) the program memory is used for storing programs, an interrupt vector table, geti instruction reference table, table data, and so forth. the m PD750104, m pd750106, and m pd750108 are provided with a mask- programmable rom as the program memory, and the m pd75p0116 is provided with a one-time prom. figures 4-3 to 4-6 show the program memory maps. program memory is addressed by the program counter. table data can be referenced using the table reference instruction (movt). figures 4-3 to 4-6 also show the allowable branch address ranges for the branch instructions and subroutine call instructions. the relative branch instruction (br $addr) allows a branch to addresses (contents of the pc less 15 to one, or plus two to 16) regardless of block. the program memory is located at following addresses. 0000h to 0fffh: m PD750104 0000h to 17ffh: m pd750106 0000h to 1fffh: m pd750108 0000h to 3fffh: m pd75p0116 the following addresses are assigned to special functions. all areas excluding 0000h and 0001h can be used as normal program memory. 0000h to 0001h vector address table for holding the rbe and mbe values and program start address when a reset signal is issued (allowing a reset start at an arbitrary address) 0002h to 000dh vector address table for holding the rbe and mbe values and program start address for each vectored interrupt (allowing interrupt processing to be started at an arbitrary address) 0020h to 007fh table area referenced by the geti instruction note note the geti instruction can represent an arbitrary two-byte or three-byte instruction or two one-byte instructions in one byte and is used to reduce the number of program bytes. (see section 11.1.1. )
51 chapter 4 internal cpu functions figure 4-3. program memory map (in m PD750104) note can be used only in the mkii mode. remark in addition to the above, the br pcde and br pcxa instructions can cause a branch to an address with only the 8 low-order bits of the pc changed. mbe 0 0 0 0 0 0 0 0 0 0 0 0 0 0 rbe 76 54 0000h mbe rbe 0002h mbe rbe 0004h mbe rbe 0006h mbe rbe 0008h mbe rbe 000ah 0020h 007fh 0080h 0 geti instruction reference table branch address specified in br !addr, br bcde, br bcxa, bra !addr1 note , call !addr, or calla !addr1 note branch/call address by geti relative branch address specified in br $addr instruction (C15 to C1, +2 to +16) entry address specified in callf !faddr instruc- tion branch address specified in brcb !caddr instruc- tion mbe rbe 000ch 0fffh 0800h 07ffh internal reset start address internal reset start address intbt/int4 start address intbt/int4 start address int0 start address int0 start address int1 start address int1 start address intcsi start address intcsi start address intt0 start address intt0 start address intt1 start address intt1 start address (high-order 4 bits) (low-order 8 bits) (high-order 4 bits) (low-order 8 bits) (high-order 4 bits) (low-order 8 bits) (high-order 4 bits) (low-order 8 bits) (high-order 4 bits) (low-order 8 bits) (high-order 4 bits) (low-order 8 bits) (high-order 4 bits) (low-order 8 bits)
52 m pd750108 user's manual figure 4-4. program memory map (in m pd750106) note can be used only in the mkii mode. remark in addition to the above, the br pcde and br pcxa instructions can cause a branch to an address with only the 8 low-order bits of the pc changed. mbe rbe 0 0 0 0 0 0 0 76 5 0000h mbe rbe 0002h mbe rbe 0004h mbe rbe 0006h mbe rbe 0008h mbe rbe 000ah 0020h 007fh 0080h 0 geti instruction reference table branch address specified in br !addr, br bcde, br bcxa, bra !addr1 note , call !addr, or calla !addr1 note branch/call address by geti relative branch address specified in br $addr instruction (C15 to C1, +2 to +16) entry address specified in callf !faddr instruc- tion branch address specified in brcb !caddr instruc- tion mbe rbe 000ch 17ffh 0800h 07ffh internal reset start address internal reset start address intbt/int4 start address intbt/int4 start address int0 start address int0 start address int1 start address int1 start address intcsi start address intcsi start address intt0 start address intt0 start address intt1 start address intt1 start address (high-order 5 bits) (low-order 8 bits) (high-order 5 bits) (low-order 8 bits) (high-order 5 bits) (low-order 8 bits) (high-order 5 bits) (low-order 8 bits) (high-order 5 bits) (low-order 8 bits) (high-order 5 bits) (low-order 8 bits) (high-order 5 bits) (low-order 8 bits) 0fffh 1000h branch address specified in brcb !caddr instruction
53 chapter 4 internal cpu functions figure 4-5. program memory map (in m pd750108) note can be used only in the mkii mode. remark in addition to the above, the br pcde and br pcxa instructions can cause a branch to an address with only the 8 low-order bits of the pc changed. mbe rbe 0 0 0 0 0 0 0 76 5 0000h mbe rbe 0002h mbe rbe 0004h mbe rbe 0006h mbe rbe 0008h mbe rbe 000ah 0020h 007fh 0080h 0 geti instruction reference table branch address specified in br !addr, br bcde, br bcxa, bra !addr1 note , call !addr or calla !addr1 note branch/call address by geti relative branch address specified in br $addr instruction (C15 to C1, +2 to +16) entry address specified in callf !faddr instruc- tion branch address specified in brcb !caddr instruc- tion mbe rbe 000ch 1fffh 0800h 07ffh internal reset start address internal reset start address intbt/int4 start address intbt/int4 start address int0 start address int0 start address int1 start address int1 start address intcsi start address intcsi start address intt0 start address intt0 start address intt1 start address intt1 start address (high-order 5 bits) (low-order 8 bits) (high-order 5 bits) (low-order 8 bits) (high-order 5 bits) (low-order 8 bits) (high-order 5 bits) (low-order 8 bits) (high-order 5 bits) (low-order 8 bits) (high-order 5 bits) (low-order 8 bits) (high-order 5 bits) (low-order 8 bits) 0fffh 1000h branch address specified in brcb !caddr instruction ,
54 m pd750108 user's manual figure 4-6. program memory map (in m pd75p0116) note can be used only in the mkii mode. remark in addition to the above, the br pcde and br pcxa instructions can cause a branch to an address with only the 8 low-order bits of the pc changed. mbe rbe 76 0000h mbe rbe 0002h mbe rbe 0004h mbe rbe 0006h mbe rbe 0008h mbe rbe 000ah 0020h 007fh 0080h 0 geti instruction reference table branch address specified in br !addr, br bcde br bcxa, bra !addr1 note , call !addr, or calla !addr1 note branch/call address by geti relative branch address specified in br $addr instruction (C15 to C1, +2 to +16) entry address specified in callf !faddr instruc- tion branch address specified in brcb !caddr instruc- tion mbe rbe 000ch 3fffh 0800h 07ffh internal reset start address internal reset start address intbt/int4 start address intbt/int4 start address int0 start address int0 start address int1 start address int1 start address intcsi start address intcsi start address intt0 start address intt0 start address intt1 start address intt1 start address (high-order 6 bits) (low-order 8 bits) (high-order 6 bits) (low-order 8 bits) (high-order 6 bits) (low-order 8 bits) (high-order 6 bits) (low-order 8 bits) (high-order 6 bits) (low-order 8 bits) (high-order 6 bits) (low-order 8 bits) (high-order 6 bits) (low-order 8 bits) 0fffh 1000h 1fffh 2fffh 3000h branch address specified in brcb !caddr instruction branch address specified in brcb !caddr instruction branch address specified in brcb !caddr instruction ,
55 chapter 4 internal cpu functions 4.4 data memory (ram): 512 words x 4 bits the data memory consists of a data area and peripheral hardware area as shown in figure 4-7. the data memory consists of the following memory banks with each bank made of 256 words x 4 bits. ? memory banks 0 and 1 (data area) ? memory bank 15 (peripheral hardware area) 4.4.1 data memory configuration (1) data area the data area consists of a static ram, and is used for storing program data and as stack memory for subroutine and interrupt execution. battery backup enables the memory to hold data for a long time even if the cpu is stopped in the standby mode. the data area can be manipulated with memory manipulation instructions. the static ram is mapped to memory banks 0 and 1, with each made up of 256 words x 4 bits. bank 0 is used as a data area, but can also be used as a general register area (000h to 01fh) and stack area note (000h to 1ffh). whole locations in memory banks 0, 1, 2, and 3 (000h to 3ffh) can be used as a stack area. the static ram has a configuration of four bits per address. however, the memory can be manipulated in 8 bit units using an 8-bit memory manipulation instruction, and in bit units using a bit manipulation instruction. note that an even address must be specified in an 8-bit manipulation instruction. note memory bank 0 or 1 can be selected as the stack area. ? general register area the general register area can be manipulated with either general register manipulation instructions or memory manipulation instructions. up to eight 4-bit registers are available. of the 8 general registers, registers not used by the program can be used as a data area or stack area. (see section 4.5. ) ? stack memory area the stack memory area is set by the instruction. this area can be used as a save area for subroutine or interrupt execution. (see section 4.7. ) (2) peripheral hardware area the peripheral hardware area is mapped at addresses f80h to fffh of memory bank 15. memory manipulation instructions are used to manipulate the peripheral hardware area as well as the static ram area. note that, however, the number of bits to be manipulated at a time varies according to the individual addresses. addresses to which no peripheral hardware is assigned cannot be accessed since such address locations contain no data memory. (see figure 3-7 .)
56 m pd750108 user's manual 4.4.2 specification of a data memory bank if the memory bank enable flag (mbe) enables bank specification (mbe = 1), a memory bank is specified with the 4-bit memory bank select register (mbs = 0, 1, 15). if the mbe disables bank specification (mbe = 0), memory bank 0 or 15 is automatically selected according to the addressing mode. locations in a bank is addressed by 8-bit immediate data or a register pair. for details on the selection of a memory bank and addressing, see section 3.1 . for how to use the particular data memory areas, see the following sections and chapter. ? general register area : section 4.5 ? stack memory area : section 4.7 ? peripheral hardware area: chapter 5 figure 4-7. data memory map note memory bank 0 or 1 can be selected as the stack area. (32 x 4) data memory 000h 01fh 020h 0ffh 100h 1ffh f80h fffh 256 x 4 (224 x 4) 256 x 4 128 x 4 0 1 15 stack area note area for general register data area static ram (512 x 4) peripheral hardware area not contained memory bank
57 chapter 4 internal cpu functions data memory is undefined when it is reset. for this reason, it is to be initialized to zero (ram clear) usually at the start of a program. remember to perform this initialization. otherwise, unexpected bugs may occur. example the following program clears data at addresses 000h to 1ffh in ram. set1 mbe sel mb0 mov xa,#00h mov hl,#04h ramc0: mov @hl,a ; clear 04h to ffh note incs l ; l 58 m pd750108 user's manual 4.5 general register: 8 x 4 bits x 4 banks the general registers are mapped to particular addresses in data memory. four banks of registers are provided, with each bank consisting of eight 4-bit registers (b, c, d, e, h, l, x, and a). the register bank (rb) to be enabled at the time of instruction execution is determined by: rb = rberbs: (rbs = 0 to 3) each general register allows 4-bit manipulation. in addition, bc, de, hl, or xa serves as a register pair for 8-bit manipulation. dl also makes a register pair as well as de and hl. these three register pairs can be used as data pointers. in 8-bit manipulation, the register pairs in the register banks (0 <> 1, 2 <> 3) that have the inverted value of bit 0 of the register bank (rb) address can be specified as bc, de, hl, and xa in addition to the register pairs bc, de, hl, and xa. (see section 3.2 .) a general register area can be addressed and accessed as normal ram, regardless of whether it is used as a register. figure 4-8. general register format address 000h 001h 002h 003h 004h 005h 006h 007h 008h 00fh 010h 017h 018h 01fh a register x register l register h register e register d register c register b register same as bank 0 same as bank 0 same as bank 0 0 3 register bank 0 register bank 1 register bank 2 register bank 3 data memory
59 chapter 4 internal cpu functions figure 4-9. register pair format 4.6 accumulator in the m pd750108, the a register and xa register pair function as accumulators. the a register is mainly used for 4-bit data processing instructions, and the xa register pair is mainly used for 8-bit data processing instructions. for a bit manipulation instruction, the carry flag (cy) functions as a bit accumulator. figure 4-10. accumulator 0 3 c 0 3 b 0 3 e 0 3 d 0 3 l 0 3 h 0 3 a 0 3 x one bank bit accumulator 4-bit accumulator 8-bit accumulator cy a a x
60 m pd750108 user's manual 4.7 stack pointer (sp) and stack bank select register (sbs) the m pd750108 uses static ram as stack memory (lifo scheme), and the 8-bit register holding the start address of the stack area is the stack pointer (sp). the stack area is located at addresses 000h to 1ffh in memory banks 0 and 1. one memory bank is selected according to the value of the 2-bit sbs. (see table 4-2 .) table 4-2. stack area to be selected by the sbs sbs stack area sbs1 sbs0 0 0 memory bank 0 0 1 memory bank 1 other than above not to be set the sp is decremented before a write (save) operation to stack memory, and is incremented after a read (restoration) operation from stack memory. figures 4-12 to 4-15 show data saved to and restored from stack memory in these stack operations. to place the stack area at a given location, the sp can be initialized with an 8-bit memory manipulation instruction, and the sbs can be initialized with a 4-bit memory manipulation instruction. both can be read from as well. when the sp is initialized to 00h, a stack operation starts at the high-order address (nffh) of memory bank (n) specified with the sbs. a stack area must be within the memory bank specified with the sbs. if a stack operation exceeds address n00h, the operation returns to address nffh in the same bank. linear stacking beyond memory bank boundaries is enabled only by resetting the sbs. a reset signal causes the contents of the sp to be undefined, and causes the contents of the sbs to be 1000b. remember to initialize the sp and sbs to a desired value at the start of a program. remark n = 0, 1
61 chapter 4 internal cpu functions figure 4-11. format of stack pointer and stack bank select register note the mk i mode and mk ii mode can be switched by bit 3 of sbs. the stack bank selection function can be used in both mk i mode and mk ii mode. (see section 4.1 for details.) example sp initialization specify memory bank 1 as a stack area to start stack operation at address 1ffh. sel mb15 ; or clr1 mbe mov a,#1 mov sbs,a ; specify memory bank 1 as a stack area mov xa,#00h mov sp,xa ; sp 62 m pd750108 user's manual figure 4-12. data saved to the stack memory (mk i mode) figure 4-13. data restored from the stack memory (mk i mode) notes 1. for the m pd75p0116, pc13 is entered instead of 0. 2. for the m PD750104, 0 is entered instead of pc12. pc11 - pc8 mbe sp + 2 pc3 - pc0 pc7 - pc4 sp + 4 ist1 cy sp + 6 sp + 1 sp + 3 sp + 5 stack rbe pc12 ist0 sk2 mbe sk1 rbe sk0 reti instruction psw pc11 - pc8 mbe sp + 2 pc3 - pc0 pc7 - pc4 sp + 4 sp + 1 sp + 3 stack rbe pc12 ret or rets instruction lower bits of pair register upper bits of pair register sp + 2 sp + 1 stack pop instruction sp sp sp 0 note 1 0 note 1 note 2 note 2 sp e 6 pc11 - pc8 mbe sp e 4 pc3 - pc0 pc7 - pc4 sp e 2 ist1 cy sp e 5 sp e 3 sp e 1 stack rbe pc12 ist0 sk2 mbe sk1 rbe sk0 interrupt psw sp e 4 pc11 - pc8 mbe sp e 2 pc3 - pc0 pc7 - pc4 sp e 3 sp e 1 stack rbe 0 pc12 call or callf instruction sp e 2 lower bits of pair register upper bits of pair register sp sp e 1 stack push instruction note 2 sp sp note 1 0 note 1 note 2
63 chapter 4 internal cpu functions figure 4-14. data saved to the stack memory (mk ii mode) figure 4-15. data restored from the stack memory (mk ii mode) notes 1. for the m pd75p0116, pc13 is entered instead of 0. 2. for the m PD750104, 0 is entered instead of pc12. 3. psw bits other than mbe and rbe are not saved or restored. remark * indicates an undefined bit. lower bits of pair register upper bits of pair register stack push instruction sp C 2 sp C 1 sp pc11 - pc8 pc3 - pc0 pc7 - pc4 stack call, calla, or callf instruction sp C 6 sp C 5 sp C 4 sp C 3 sp C 2 sp C 1 sp * * * * mbe * rbe * 00 pc11 - pc8 pc3 - pc0 pc7 - pc4 stack interrupt sp C 6 sp C 5 sp C 4 sp C 3 sp C 2 sp C 1 sp ist1 cy ist0 sk2 mbe sk1 rbe sk0 psw 00 note 3 pc12 pc12 0 0 note 1 note 2 note 1 note 2 lower bits of pair register upper bits of pair register stack pop instruction sp sp + 1 sp + 2 pc11 - pc8 pc3 - pc0 pc7 - pc4 stack ret or rets instruction sp sp + 1 sp + 2 sp + 3 sp + 4 sp + 5 sp + 6 * * * * mbe * rbe * 00 pc11 - pc8 pc3 - pc0 pc7 - pc4 stack reti instruction ist1 cy ist0 sk2 mbe sk1 rbe sk0 psw 00 note 3 sp sp + 1 sp + 2 sp + 3 sp + 4 sp + 5 sp + 6 pc12 pc12 0 note 1 0 note 1 note 2 note 2
64 m pd750108 user's manual 4.8 program status word (psw): 8 bits the program status word (psw) consists of various flags closely associated with processor operations. the psw is mapped to addresses fb0h and fb1h in data memory space. four bits at address fb0h can be manipulated with a memory manipulation instruction. figure 4-16. program status word format table 4-3. psw flags saved/restored in stack operation saved/restored flag save when a call, calla, or callf instruction is executed mbe and rbe are saved. when a hardware interrupt occurs all psw bits are saved. restore when a ret or rets instruction is executed mbe and rbe are restored. when a reti is executed all psw bits are restored. (1) carry flag (cy) the carry flag is a 1-bit flag used to store information about an overflow or underflow that occurs when an arithmetic operation with a carry (addc, subc) is executed. the carry flag functions as a bit accumulator, and therefore can be used to store the result of a boolean algebra operation performed on the cy and a bit at a specified data memory bit address. the carry flag is manipulated using special instructions, independently of the other psw bits. a reset signal causes the carry flag to be undefined. rbe mbe ist0 ist1 sk0 sk1 sk2 cy address can be manipulated by an instruction specifically provided for controlling this flag cannot be manipulated can be manipulated symbol psw fb1h fb0h fb0h
65 chapter 4 internal cpu functions table 4-4. carry flag manipulation instructions instruction (mnemonic) carry flag operation/processing instruction dedicated to carry set1 cy sets cy to 1. flag manipulation clr1 cy clears cy to 0. not1 cy inverts the state of cy. skt cy skips if cy is 1. bit transfer instruction mov1 mem*.bit, cy transfers the state of cy to a specified bit. mov1 cy, mem*.bit transfers the state of a specified bit to cy. bit boolean instruction and1 cy, mem*.bit ands, ors, or xors cy with a specified bit, or1 cy, mem*.bit then sets the result in cy. xor1 cy, mem*.bit interrupt handling interrupt execution saves cy and all other psw bits to stack memory in parallel. reti restores cy together with the other psw bits from stack memory in parallel. remark mem*.bit represents the following bit addressing: ? fmem.bit ? pmem.@l ? @h+mem.bit example bit 3 at address 3fh is anded with p33, then the result is set in p50. mov h,#3h ; set the high-order 4 bits of the address in h register mov1 cy,@h+0fh.3 ; cy 66 m pd750108 user's manual table 4-5. information indicated by the interrupt status flag ist1 ist0 status of processing processing and interrupt control being performed 0 0 status 0 normal program processing is being performed. any interrupts are acceptable. 0 1 status 1 a lower- or higher-priority interrupt is being serviced. higher-priority interrupts are acceptable. 1 0 status 2 a higher-priority interrupt is being serviced. no interrupts are acceptable. 1 1 not to be set the interrupt priority control circuit (see figure 6-1 ) checks this flag to control multiple interrupts. the contents of the ist1 and ist0 are saved as part of the psw to stack memory if an interrupt is accepted, then are automatically set to a one-step higher status. the reti instruction restores the contents present before an interrupt occurs. the interrupt status flag can be manipulated using a memory manipulation instruction, and the status of processing being performed can be changed by program control. caution the user must always disable interrupts with the di instruction before manipulating this flag, and must enable interrupts with the ei instruction after manipulating this flag. (4) memory bank enable flag (mbe) the memory bank enable flag is a 1-bit flag used to specify the address information generation mode for the high-order four bits of a 12-bit data memory address. the mbe can be set or reset any time with a bit manipulation instruction, regardless of memory bank setting. when the mbe is set to 1, the data memory address space is expanded, allowing all data memory space to be addressed. when the mbe is reset to 0, the data memory address space is fixed, regardless of mbs setting. (see figure 3-2 .) a reset signal automatically initializes the mbe by setting the mbe to the content of bit 7 at program memory address 0. in vectored interrupt processing, the mbe is automatically set to the content of bit 7 in the vector address table for servicing the interrupt. usually, the mbe is set to 0 in interrupt processing, and static ram in memory bank 0 is used. (5) register bank enable flag (rbe) the register bank enable flag is a 1-bit flag used to determine whether to expand the general register bank configuration. the rbe can be set or reset any time with a bit manipulation instruction, regardless of memory bank setting. when the rbe is set to 1, a set of general registers can be selected from register banks 0 to 3, depending on the setting of the register bank select register (rbs).
67 chapter 4 internal cpu functions when the rbe is reset to 0, register bank 0 is always selected as general registers, regardless of the setting of the rbs. a reset signal automatically initializes the rbe by setting the rbe to the state of bit 6 at program memory address 0. when a vectored interrupt occurs, the rbe is automatically set to the state of bit 6 in the vector address table for servicing the interrupt. usually, the rbe is set to 0 in interrupt processing. register bank 0 is used for 4-bit processing, and register banks 0 and 1 are used for 8-bit processing. 4.9 bank select register (bs) the bank select register (bs) consists of a register bank select register (rbs) and memory bank select register (mbs), which specify a register bank and memory bank to be used, respectively. the rbs and mbs are set using the sel rbn instruction and sel mbn instruction, respectively. the contents of the bs can be saved to or restored from a stack memory eight bits at a time by using the push bs/pop bs instruction. figure 4-17. bank select register format (1) memory bank select register (mbs) the memory bank select register is a 4-bit register used to store the high-order four bits of a 12-bit data memory address. the contents of this register specify a memory bank to be accessed. the m pd750108 allows memory banks 0, 1, and 15 only to be specified. the mbs is set with the sel mbn instruction (n = 0, 1, 15). figure 3-2 shows the range of addressing using mbe and mbs settings. a reset signal initializes the mbs to 0. (2) register bank select register (rbs) the register bank select register specifies a register bank to be used as general registers; a register bank can be selected from register banks 0 to 3. the rbs is set by the sel rbn instruction (n = 0 to 3). a reset signal initializes the rbs to 0. symbol bs mbs3 mbs2 mbs1 mbs0 0 0 rbs1 rbs0 f83h f82h address f82h
68 m pd750108 user's manual table 4-6. register bank to be selected with the rbe and rbs bank 0 is always selected. rbe rbs 3210 000xx bank 0 is selected. 00 bank 1 is selected. 100 01 bank 2 is selected. 10 bank 3 is selected. 11 register bank x: dont care always 0
69 chapter 5 peripheral hardware functions chapter 5 peripheral hardware functions 5.1 digital i/o ports the m pd750108 employs the memory mapped i/o method. thus, all input/output ports are mapped on the data memory space. figure 5-1. data memory addresses of digital ports remark some i/o parts can be used as static ram. input/output port manipulation instructions are as listed in table 5-2. ports 4 to 7 can be manipulated not only in 4-bit units, but also in 8-bit or 1-bit units so that these ports can be controlled in various ways. examples 1. to test the condition of p13 and output different values to ports 4 and 5 according to the test result: skt port1. 3 ; skips if bit 3 of port 1 is 1 mov xa, #18h ; xa 70 m pd750108 user's manual allows input or output mode setting in units of 4 bits. whether to use pull-up resistors can be specified, bit-by-bit, with the mask option note 2 . allows input or output mode setting on a bit-by-bit basis. ports 6 and 7 can be paired, allowing data i/o in units of 8 bits. ports 4 and 5 can be paired, allowing data i/o in units of 8 bits. 5.1.1 types, features, and configurations of digital i/o ports table 5-1 lists the types of digital i/o ports. figures 5-2 to 5-6 show the configurations of the ports. table 5-1. types and features of digital ports port function operation and feature remarks (pin name) port0 4-bit input when the serial interface function is used, also used as int4, sck, (p00-p03) operation mode causes the dual-function pin so/sb0, and si/sb1. to become an output pin. port1 4-bit input-only port also used as int0-int2 (p10-p13) and ti0. port2 4-bit i/o allows input or output mode setting in units also used as pto0, pto1, (p20-p23) of 4 bits. pcl, and buz. port3 allows input or output mode setting on a also used as md0-md3 note 1 . (p30-p33) bit-by-bit basis. port4 4-bit i/o also used as d0-d3 note 1 . (p40-p43) (n-ch open-drain; withstand voltage port5 of 13 v) also used as d4-d7 note 1 . (p50-p53) port6 4-bit i/o also used as kr0-kr3. (p60-p63) port7 also used as kr4-kr7. (p70-p73) port8 2-bit i/o allows input or output mode setting in units - (p80-p81) of 2 bits. notes 1. only for the m pd75p0116. 2. pull-up resistors, specified with the mask option, are not connected to the m pd75p0116. p10 is also used as an external vectored interrupt input pin. this input is provided with a noise eliminator. (see section 6.3 for details.) when the reset signal is generated, output latches of ports 2 to 8 are cleared to 0 and the output buffer is turned off so that these ports are in the input mode. allows input or output mode setting in units of 4 bits.
71 chapter 5 peripheral hardware functions figure 5-2. configurations of ports 0 and 1 internal bus 8 csim selector selector p01 output latch internal sck si sck so int4 v dd pull-up resistor p-ch p00/int4 p01/sck p02/so/sb0 p03/si/sb1 bit 0 of poga input buffer output buffer which can be switched to either push-pull output or n-ch open-drain output pull-up resistor v dd p-ch p10/int0 p11/int1 p12/int2 p13/ ti0 bit 1 of poga input buffer f or f cc /64 input buffer with hysteresis ti0 int2 int1 int0 noise eliminator selector n-ch open drain
72 m pd750108 user's manual figure 5-3. configurations of ports 2 and 7 note for port 7 only m p x input buffer pmm = 0 key interrupt note output latch pmm bits 2 and 7 of port mode register group b (m = 2, 7) output buffer internal bus pm0 pm1 pm2 pm3 bit m of poga pull-up resistor v dd p-ch input buffer with hysteresis note pmm = 1
73 chapter 5 peripheral hardware functions figure 5-4. configurations of ports 3n and 6n (n = 0 to 3) note for port 6n only bit m of poga pull-up resistor p-ch v dd pmn input buffer m p x pmmn = 0 pmmn = 1 pmmn output latch corresponding bits of port mode register group a output buffer m = 3, 6 n = 0 to 3 internal bus input buffer with hysteresis note key interrupt note
74 m pd750108 user's manual figure 5-5. configurations of ports 4 and 5 internal bus input buffer mpx v dd pm0 pm1 pm2 pm3 pmm = 0 pmm = 1 pmm output latch pull-up resistor n-ch open-drain output buffer corresponding bits of port mode register group b (m = 4, 5) (mask option)
75 chapter 5 peripheral hardware functions figure 5-6. configuration of port 8 internal bus p80 p81 bit 0 of pogb pull-up resistor v dd p-ch pm8 ouput latch m p x output buffer corresponding bit of port mode register group c input buffer pm8 = 1 pm8 = 0
76 m pd750108 user's manual 5.1.2 i/o mode setting the i/o mode of each i/o port is set by the port mode register as shown in figure 5-7. the i/o modes of ports 3 and 6 can be set bit by bit by port mode register group a (pmga). the i/o modes of ports 2, 4, 5, and 7 can be set in units of four bits by port mode register group b (pmgb). the i/o mode of port 8 can be set in units of two bits by port mode register group c (pmgc). each port functions as an input port when the corresponding bit of the port mode register is set to 0, and functions as an output port when the same corresponding bit is set to 1. when the output mode is selected by the port mode register, the contents of the output latch appear on the output pins, and so the contents of the output latch must be changed to a desired value before the output mode is set. an 8-bit memory manipulation instruction is used to set port mode register group a, b, or c. a reset signal clears all bits of each port mode register to 0. this means that the output buffers are set off, and all ports are placed in the input mode. example p30, p31, p62, and p63 are used as input pins, and p32, p33, p60, and p61 are used as output pins. clr1 mbe ; or sel mb15 mov xa,#3ch mov pmga,xa
77 chapter 5 peripheral hardware functions figure 5-7. formats of port mode registers 0 1 input mode (output buffer off) output mode (output buffer on) contents of specification pm63 pm62 pm61 pm60 pm33 pm31 pm32 pm30 76543 1 20 fe8h address pmga symbol p30 i/o specification p31 i/o specification p32 i/o specification p33 i/o specification p60 i/o specification p61 i/o specification p62 i/o specification p63 i/o specification pm7 pm5 pm4 pm2 76543 1 20 fech address pmgb symbol port 2 (p20 - p23) i/o specification port 4 (p40 - p43) i/o specification port 5 (p50 - p53) i/o specification port 7 (p70 - p73) i/o specification port mode register group a port mode register group b pm8 76543 1 20 feeh address pmgc symbol port mode register group c port 8 (p80, p81) i/o specification
78 m pd750108 user's manual 5.1.3 digital i/o port manipulation instructions all i/o ports contained in the m pd750108 are mapped to data memory space, so that all data memory manipulation instructions can be used. table 5-2 lists the instructions that are particularly useful for i/o pin manipulation and their application ranges. (1) bit manipulation instructions for digital i/o ports port0 to port8, specific address bit direct addressing (fmem.bit) and specific address bit register indirect addressing (pmem.@l) can be used. this means that bit manipulation can be freely performed for these ports regardless of mbe and mbs settings. example p50 is ored with p41, then the result is output to p61. set1 cy ; cy 79 chapter 5 peripheral hardware functions (3) 8-bit manipulation instructions the mov, xch, and ske instructions as well as the in and out instructions can be used for ports 4 and 5 that allow 8-bit manipulation. as with 4-bit manipulation, memory bank 15 must be selected in advance. example the data contained in the bc register pair is output on the output port specified by 8-bit data applied to ports 4 and 5. set1 mbe sel mb15 in xa,port4 ; xa 80 m pd750108 user's manual table 5-2. i/o pin manipulation instructions port port port port port port port port port port instruction 0 1 2 3 4 5 6 7 8 in a, portn note 1 in xa, portn note 1 out portn, a note 1 out portn, xa note 1 mov a, portn note 1 mov xa, portn note 1 mov portn, a note 1 mov portn, xa note 1 xch a, portn note 1 xch xa, portn note 1 mov1 cy, portn.bit mov1 cy, portn.@l note 2 mov1 portn.bit, cy mov1 portn.@l, cy note 2 incs portn note 1 set1 portn.bit set1 portn.@l note 2 clr1 portn.bit clr1 portn.@l note 2 skt portn.bit skt portn.@l note 2 skf portn.bit skf portn.@l note 2 sktclr portn.bit sktclr portn.@l note 2 and1 cy, portn.bit and1 cy, portn.@l note 2 or1 cy, portn.bit or1 cy, portn.@l note 2 xor1 cy, portn.bit xor1 cy, portn.@l note 2 notes 1. mbe = 0 or (mbe = 1, mbs = 15) must be set before execution. 2. the low-order two bits of an address and bit address are indirectly specified using the l register. *
81 chapter 5 peripheral hardware functions 5.1.4 digital i/o port operation when a data memory manipulation instruction is executed for a digital i/o port, the operation of the port and pins depends on the i/o mode setting (table 5-3). this is because data taken in on the internal bus is the data input from the pins in the input mode, or the output latch data in the output mode, as obvious from the configurations of i/o ports. (1) operation when the input mode is set data from each pin is manipulated when a test instruction such as the skt instruction ,a bit input instruction such as mov1,or an instruction for taking in port data on the internal bus in units of four or eight bits (such as an in, mov, arithmetic/logical or comparison instruction) is executed. when an instruction (the out or mov instruction) is executed to transfer the contents of the accumulator to a port in units of four or eight bits, the data of the accumulator is latched in the output latch, with the output buffers kept off. when the xch instruction is executed, the data on each pin is loaded into the accumulator, and the data in the accumulator is latched in the output latch, with the output buffers kept off. when the incs instruction is executed, the 4-bit data existing on the pins plus 1 is latched in the output latch, with the output buffers kept off. when an instruction such as the set1, clr1, or sktclr instruction is executed to rewrite a data memory bit, the output latch data of the specified bit can be rewritten according to the instruction, but the states of the other output latch bits are undefined. (2) operation when the output mode is set when a test instruction or instruction for taking in port data on the internal bus in units of four or eight bits is executed, output latch data is manipulated. when an instruction is executed to transfer the contents of the accumulator in units of four or eight bits, the output latch data is rewritten, and is output on the pins. when the xch instruction is executed, the output latch data is transferred to the accumulator. the contents of the accumulator are latched in the output latches, and are output on the pins. when the incs instruction is executed, the contents of the output latch incremented by 1 are latched in the output latch, and are output on the pins. when a bit output instruction is executed, the specified bit of the output latch is rewritten, and is output on the pin.
82 m pd750108 user's manual table 5-3. operations by i/o port manipulation instructions instruction port and pin operation input mode output mode skt <1> pin data is tested. output latch data is tested. skf <1> mov1 cy, <1> pin data is transferred to cy. output latch data is transferred to cy. and1 cy, <1> an operation is performed on pin data and an operation is performed or1 cy, <1> cy. on output latch data and cy. xor1 cy, <1> in a,portn pin data is transferred to the accumulator. output latch data is transferred to the in xa,portn accumulator. mov a,portn mov xa,portn mov a,@hl mov xa,@hl adds a,@hl an operation is performed on pin data and an operation is performed addc a,@hl the accumulator. on output latch data and the accumulator. subs a,@hl subc a,@hl and a,@hl or a,@hl xor a,@hl ske a,@hl pin data is compared with the output latch data is com- ske xa,@hl accumulator. pared with the accumulator. out portn,a accumulator data is transferred to the accumulator data is transferred to the out portn,xa output latch (with the output buffers kept output latch and is output on the pins. mov portn,a off). mov portn,xa mov @hl,a mov @hl,xa xch a,portn pin data is transferred to the accumulator, data is exchanged between the output xch xa,portn and accumulator data is transferred to the latch and accumulator. xch a,@hl output latch (with the output buffers kept xch xa,@hl off). incs portn pin data incremented by 1 is latched in output latch data is incremented by 1. incs @hl the output latch. set1 <1> the output latch data of a specified bit is the output pin state is modified according clr1 <1> rewritten, but the output latch data of the to the instruction. mov1 <1> ,cy other bits is undefined. sktclr <1> <1> : represents an addressing mode portn.bit or portn.@l. * * * *
83 chapter 5 peripheral hardware functions 5.1.5 specification of built-in pull-up resistors a pull-up resistor can be contained at each port pin of the m pd750108 (except for p00). whether to use the pull-up resistor can be specified by software (for some pins) or a mask option (for the other pins). table 5-4 shows how a built-in pull-up resistor is specified for each port pin. the built-in pull-up resistor is connected by software in the format shown in figure 5-8. in input mode, the pull-up resistor can be connected only to the pins of port 3 and 6. when the pins are set in output mode, the pull-up resistor cannot be connected regardless of the settng of poga. table 5-4. specification of built-in pull-up resistors port (pin name) pull-up resistor incorporation specification method specified bit port 0 (p01-p03) note connection specification by software in units of 3 bits poga.0 port 1 (p10-p13) connection specification by software in units of 4 bits poga.1 port 2 (p20-p23) poga.2 port 3 (p30-p33) poga.3 port 4 (p40-p43) connection specification by software, bit-by-bit - port 5 (p50-p53) port 6 (p60-p63) connection specification by software in units of 4 bits poga.6 port 7 (p70-p73) poga.7 port 8 (p80, p81) connection specification by software in units of 2 bits pogb.0 note the p00 pin cannot specify connection of a built-in pull-up resistor. remark pull-up resistors, specified with the mask option, are not connected to the m pd75p0116.
84 m pd750108 user's manual figure 5-8. pull-up resistor specification register format pull-up resistor specification register group a pull-up resistor specification register group b 5.1.6 i/o timing of digital i/o ports figure 5-9 shows the timing of data output to an output latch and the timing of taking in pin data or output latch data on the internal bus. figure 5-10 shows an on timing chart when a built-in pull-up resistor is connected to a port pin by software. figure 5-9. i/o timing chart of digital i/o ports (1/2) (a) when data is input by a 1-machine cycle instruction 0 1 built-in pull-up resistor not connected built-in pull-up resistor connected specification contents po7 po6 po3 po1 po2 po0 76543 1 20 fdch address poga symbol port 0 (p01 - p03) port 1 (p10 - p13) port 2 (p20 - p23) port 3 (p30 - p33) port 6 (p60 - p63) port 7 (p70 - p73) 76543 1 20 fdeh address pogb symbol port 8 (p80, p81) po8 instruction execution 1 machine cycle manipulation instruction input timing f 0 f 1 f 2 f 3
85 chapter 5 peripheral hardware functions figure 5-9. i/o timing chart of digital i/o ports (2/2) (b) when data is input by a 2-machine cycle instruction (c) when data is latched by a 1-machine cycle instruction (d) when data is latched by a 2-machine cycle instruction figure 5-10. on timing chart of built-in pull-up resistor connected by software instruction execution 2 machine cycles input timing manipulation instruction f 0 f 1 f 2 f 3 instruction execution manipulation instruction output latch (output pin) 301 fff instruction execution output latch (output pin) 01 ff manipulation instruction instruction execution pull-up resistor specification register 2 machine cycles built-in pull-up resistor setting instruction f 0 1 f
86 m pd750108 user's manual 5.2 clock generator the clock generator supplies various clock signals to the cpu and peripheral hardware to control the cpu operation mode. 5.2.1 clock generator configuration figure 5-11 shows the configuration of the clock generator. figure 5-11. block diagram of the clock generator note instruction execution remarks 1. f cc : main system clock frequency 2. f xt : subsystem clock frequency 3. f = cpu clock 4. pcc: processor clock control register 5. scc: system clock control register 6. one clock cycle (t cy ) of the cpu clock ( f ) is equal to one machine cycle of an instruction. subsystem clock generator main system clock generator clock timer basic interval timer (bt) timer/event counter timer counter serial interface clock timer int0 noise eliminator clock output circuit 1/1 to 1/4096 frequency divider selec- tor selec- tor frequency divider f oscillator disable signal internal bus halt note stop note pcc2, pcc3 clear signal wait release signal from bt standby release signal from interrupt control circuit reset signal xt1 xt2 cl1 cl2 4 scc scc3 scc0 pcc pcc0 pcc1 pcc2 pcc3 stop flip-flop qs r halt flip-flop s q r f xt f cc 1/2 1/16 1/4 1/4 cpu int0 noise eliminator clock output circuit wm.3 (rc oscillation, external resistor and capacitor)
87 chapter 5 peripheral hardware functions 5.2.2 functions and operations of the clock generator the clock generator generates the following clocks, and controls the cpu operation modes such as the standby mode. ? main system clock f cc ? subsystem clock f xt ? cpu clock f clock to peripheral hardware the operation of the clock generator is determined by the processor clock control register (pcc) and system clock control register (scc). the function and operation of the clock generator are described in (a) to (g) below. (a) a reset signal selects the lowest-speed mode (32 m s at 2 mhz) note 1 for the main system clock (pcc = 0, scc = 0). (b) when the main system clock is selected, the pcc can be set to select one of four cpu clocks (2, 4, 8, and 32 m s at 2 mhz) note 2 . (c) when the main system clock is selected, the two standby modes, stop mode and halt mode, are available. (d) the scc can be set to select the subsystem clock for very low-speed, low-current operation (122 m s at 32.768 khz). the value in the pcc does not affect the cpu clock. (e) when the subsystem clock is selected, main system clock generation can be stopped with the scc. in addition, the halt mode can be used, but the stop mode cannot be used. (subsystem clock generation cannot be stopped.) (f) the clock to be supplied to peripheral hardware is produced by frequency-dividing the main system clock signal. the subsystem clock can directly be supplied only to the clock timer. this enables the clock function and the buzzer output function to continue operating even in the standby state. (g) when the subsystem clock is selected, the clock timer can continue to operate normally. the serial interface, timer/event counter, and timer counter can continue to operate when the external clock is selected. however, other hardware cannot be used when the main system clock is stopped because they operate with the main system clock. notes 1. at f cc = 1 mhz: 64 m s 2. at f cc = 1 mhz: 4, 8, 16, and 64 m s
88 m pd750108 user's manual (1) processor clock control register (pcc) the pcc is a 4-bit register for selecting a cpu clock f with the low-order two bits and for controlling the cpu operation mode with the high-order two bits (see figure 5-12 ). when bit 3 or bit 2 is set to 1, the standby mode is set. when the standby mode is released by the standby release signal, these bits are automatically cleared to return to the normal operation mode. (see chapter 7 for details.) a 4-bit memory manipulation instruction is used to set the low-order two bits of the pcc. (the high-order two bits are set to 0.) bit 3 and bit 2 are set to 1 using the stop instruction and halt instruction, respectively. the stop instruction and halt instruction can always be executed regardless of mbe setting. the cpu clock can be selected only while the processor is operated by the main system clock. when the processor is operated by the subsystem clock, the low-order 2 bits of the pcc are invalidated, and f xt /4 is automatically set. the stop instruction can be executed only when the processor is operated by the main system clock. examples 1. the machine cycle is entered in highest-speed mode (2 m s at f cc = 2 mhz). sel mb15 mov a,#0011b mov pcc,a 2. the machine cycle is set to 8 m s (at f cc = 1 mhz). sel mb15 mov a,#0010b mov pcc,a 3. the stop mode is set. (a stop instruction or halt instruction must always be followed by an nop instruction.) stop nop a reset signal clears the pcc to 0.
89 chapter 5 peripheral hardware functions figure 5-12. format of the processor clock control register address fb3h 3210 pcc3 pcc2 pcc1 pcc0 symbol pcc cpu clock selection bit (operation with f cc = 2 mhz) ( ) is actual frequency at f cc = 2 mhz cpu clock frequency f = f cc /64 (31.3 khz) 1 machine cycle 1 machine cycle scc3, scc0 = 00 ( ) is actual frequency at f xt = 32.768 khz scc3, scc0 = 01 or 11 cpu clock frequency f = f xt /4 (8.192 khz) f = f cc /16 (125 khz) 8 s f = f cc /8 (250 khz) f = f cc /4 (500 khz) 4 s 2 s 122 s 0 0 1 0 0 1 11 (operation with f cc = 1 mhz) ( ) is actual frequency at f cc =1 mhz cpu clock frequency f = f cc /64 (15.6 khz) 1 machine cycle 1 machine cycle scc3, scc0 = 00 ( ) is actual frequency at f xt = 32.768 khz scc3, scc0 = 01 or 11 cpu clock frequency f = f xt /4 (8.192 khz) f = f cc /16 (62.5 khz) f = f cc /8 (125 khz) f = f cc /4 (250 khz) 8 s 64 s 122 s 0 0 1 0 0 1 11 normal operation mode halt mode stop mode not to be set 0 0 1 0 0 1 11 cpu operation mode control bits 32 s 16 s 4 s remarks 1. f cc : output frequency from the main system clock oscillator 2. f xt : output frequency from the subsystem clock oscillator
90 m pd750108 user's manual (2) system clock control register (scc) the scc is a 4-bit register for selecting cpu clock f with the least significant bit and for controlling the termination of main system clock generation with the most significant bit (see figure 5-13 ). bits 0 and 3 of the scc are located at the same data memory address, but both bits cannot be changed at the same time. accordingly, bits 0 and 3 of the scc are set using bit manipulation instructions. bits 0 and 3 of the scc can be manipulated regardless of mbe setting. main system clock generation can be terminated by setting bit 3 of the scc only when the subsystem clock is used for operation. the stop instruction must be used to terminate main system clock generation. a reset signal clears the scc to 0. figure 5-13. format of the system clock control register cautions 1. a time period of up to 1/f xt is needed to change the system clock. this means that to terminate main system clock generation, bit 3 of the scc must be set to 1 when the machine cycles indicated in table 5-4 or more have elapsed after the clock is switched from the main system clock to the subsystem clock. 2. when the main system clock is used for operation, setting bit 3 of the scc to stop clock generation does not enter the normal stop mode. address fb7h scc3 scc0 symbol scc cpu clock frequency main system clock main system clock operation subsystem clock can oscillate subsystem clock 0 0 1 0 0 1 11 oscillation stopped scc0 scc3 not to be set 3210
91 chapter 5 peripheral hardware functions (3) system clock oscillator the main system clock oscillator operates with a resistor (r) and capacitor (c) connected to the cl1 and cl2 pins, as shown in figure 5-14. the external clock cannot be input. the output frequency (f cc ) of the main system clock oscillator is determined from the resistance (r) and capacitance (c), as follows: f cc = 1 2rc caution f cc may be subject to a frequency deviation caused by a variation in the supply voltage or temperature. figure 5-14. external circuit for the main system clock oscillator rc oscillation the subsystem clock oscillator operates with a crystal resonator (32.768 khz standard) connected to the xt1 and xt2 pins. an external clock can also be input. input the clock signal to the xt1 pin and its inverted signal to the xt2 pin. the state of the xt1 pin is tested by bit 3 of the clock mode register (wm). figure 5-15. external circuit for the subsystem clock oscillator (a) crystal oscillation (b) external clock c r cl1 cl2 v ss pd750108 v ss xt1 xt2 crystal (standard frequency: 32.768 khz) pd750108 xt1 xt2 external clock pd750108 *
92 m pd750108 user's manual caution when the main system clock or subsystem clock oscillator is used, conform to the following guidelines when wiring enclosed in broken lines of figures 5-14 and 5-15 to eliminate the influence of the stray capacitance around the wiring. ? the wiring must be as short as possible. ? other signal lines must not run in these areas. any line carrying a high pulsating current must be kept away as far as possible. ? the grounding point of the capacitor of the oscillator must have the same potential as that of v ss . it must not be grounded to a grounding pattern carrying a high current. ? no signal must be taken directly from the resonator. the subsystem clock oscillator has low amplification to minimize current consumption. for this reason, more malfunctions can occur due to noise than the main system clock oscillator. so pay special attention to wiring when using the subsystem clock. figure 5-16 gives examples of oscillator connections which should be avoided. figure 5-16. examples of oscillator connections which should be avoided (1/4) (a) the wiring is too long. ? main system clock ? subsystem clock pd750108 cl1 cl2 v ss pd750108 xt1 xt2 v ss
93 chapter 5 peripheral hardware functions figure 5-16. examples of oscillator connections which should be avoided (2/4) (b) the signal lines cross. ? main system clock ? subsystem clock (c) a high pulsating current is too close to the signal line. ? main system clock ? subsystem clock pd750108 cl1 cl2 v ss portn (n = 0-8) pd750108 xt1 xt2 v ss portn (n = 0-8) pd750108 cl1 cl2 v ss high current pd750108 xt1 xt2 v ss high current
94 m pd750108 user's manual figure 5-16. examples of oscillator connections which should be avoided (3/4) (d) the current flows through the ground line of the oscillator. (the potential at points a, b, and c fluctuates.) ? main system clock ? subsystem clock (e) a signal is taken directly from the resonator. ? main system clock ? subsystem clock cl1 cl2 v ss portn v dd ab pd750108 (n = 0-8) high current xt1 xt2 v ss portn v dd ac b pd750108 (n = 0-8) high current xt1 xt2 v ss pd750108 cl1 cl2 v ss pd750108
95 chapter 5 peripheral hardware functions figure 5-16. examples of oscillator connections which should be avoided (4/4) (f) the signal lines of the main system clock and subsystem clock are parallel and adjacent to each other. (4) frequency divider the frequency divider divides the output (f cc ) of the main system clock oscillator to generate various clocks. pd750108 v ss xt1 xt2 cl1 cl2 xt2 and cl1 are wired in parallel.
96 m pd750108 user's manual (5) control functions of subsystem clock oscillator the subsystem clock oscillator of the m pd750108 subseries has two control functions to decrease the supply current. the function to select with the software whether to use the built-in feedback resistor note ? the function to suppress the supply current by reducing the drive current of the built-in inverter when the operating supply voltage is high (v dd 3 2.7 v) note when the subsystem clock is not to be used, select sos.0 = 1 by software (the built-in feedback resistor will not be used), connect the xt1 pin to v ss or v dd , and leave the xt2 pin open. this reduces the supply current to the subsystem clock oscillator. each function can be used by switching bits 0 and 1 in the sub-oscillator control register (sos). (see figure 5-17 .) figure 5-17. subsystem clock oscillator sos.0 sos.1 xt1 xt2 inverter feedback resistor pd750108 *
97 chapter 5 peripheral hardware functions (6) sub-oscillator control register (sos) the sos register specifies whether to use the built-in feedback resistor and controls the drive current of the built-in inverter. (see figure 5-18 .) inputting a reset signal clears all bits of the sos register. the functions of each flag in the sos register are described below. (a) sos.0 (feedback resistor cut flag) to use the feedback resistor of the subsystem clock, the mask option setup and switching sos.0 by software are required. set sos.0 to 0 to turn on the feedback circuit. when the resonator is not used, set sos.0 to 1. the feedback circuit is turned off, reducing the current drain. to use the resonator, be sure to select "enable the feedback resistor" upon setting the mask option. then, set sos.0 to 0 (feedback circuit is turned on). (b) sos.1 (drive capability switch flag) the built-in inverter in the subsystem clock oscillator of the m pd750108 subseries has a large drive current because it can be used at low supply voltage (v dd = 1.8 v), so that the supply current becomes too high to use at high supply voltage (v dd 3 2.7 v). to reduce the supply current, set sos.1 to 1 so as to reduce the drive current of the inverter. however, if sos.1 is set to 1 when v dd is less than 2.7 v, the oscillation may stop for insufficient drive current. set this flag to 0 when v dd is less than 2.7 v. figure 5-18. sub-oscillator control register (sos) format remark if the subsystem clock is not required , the xt1 and xt2 pins and sos register must be treated as follows: xt1 : connected to v ss or v dd . xt2 : open sos: 00x1b (x: don't care) 0 0 1 built-in feedback resistor is used. built-in feedback resistor is not used. cut flag for feedback resistor of the sub-oscillator 0 sos1 sos0 fcfh sos 3210 address symbol 0 1 drive current is high (1.8 v v dd ) drive current is low (2.7 v v dd ) cut flag for the sub-oscillator current bits 2 and 3 of sos must be set to 0. *
98 m pd750108 user's manual 5.2.3 system clock and cpu clock setting (1) time required to change the system clock and cpu clock the system clock and cpu clock can be changed by using the least significant bit of the scc and the low-order two bits of the pcc. this switching is not performed immediately after the contents of the registers are rewritten, but the system operates with the previous clock for some machine cycles. accordingly, after this time period, the stop instruction must be executed to terminate main system clock generation. table 5-5. maximum time required to change the system clock and cpu clock note cannot be emulated using the tool. remarks 1. time indicated in parentheses is required when f cc = 2 mhz and f xt = 32.768 khz. 2. x: don't care 3. cpu clock f is supplied to the cpu of the m pd750108. the reciprocal of this frequency is a minimum instruction time (defined as one machine cycle in this manual). caution the fluctuation of the ambient temperature around an oscillator and the performance of a load capacity change f cc and f xt . in particular, when f cc is higher than the nominal value or f xt is lower than the nominal value, the machine cycles calculated by f cc /64f xt , f cc / 16f xt , f cc / 8f xt , and f cc /4f xt in table 5-5 are longer than the machine cycle calculated by the nominal values of f cc and f xt . therefore, the wait time required to change the system clock and cpu clock should be longer than the machine cycle calculated by the nominal values of f cc and f xt . * setting before switching scc0 pcc1 pcc0 scc0 0 pcc1 0 pcc0 0 scc0 0 pcc1 0 pcc0 1 scc0 0 setting after switching 1 pcc0 0 scc0 0 pcc1 1 pcc0 1 scc0 1 pcc1 x pcc0 x f cc /64f xt machine cycles (1 machine cycle) 1 machine cycle 1 machine cycle 1 machine cycle 00 f cc /16f xt machine cycles note (4 machine cycles) 4 machine cycles 4 machine cycles 01 f cc /8f xt machine cycles (8 machine cycles) 8 machine cycles 8 machine cycles 10 f cc /4f xt machine cycles (15 machine cycles) 16 machine cycles 16 machine cycles 11 1 machine cycle 1 machine cycle 1 machine cycle note xx 4 machine cycles 8 machine cycles 16 machine cycles 1 machine cycle 0 1 pcc1
99 chapter 5 peripheral hardware functions (2) procedure for changing the system clock and cpu clock the procedure for changing the system clock and cpu clock is explained using figure 5-19. figure 5-19. changing the system clock and cpu clock <1> a reset signal starts cpu operation at the lowest speed of the main system clock (32 m s at 2 mhz, 64 m s at 1 mhz) after a wait time note 1 for stable oscillation. <2> the pcc is rewritten for highest-speed operation after a time elapse which is sufficient for the voltage on the v dd pin to be high enough for highest-speed operation. <3> the removal of commercial current is detected using, for example, an interrupt input note 2 , then bit 0 of the scc is set to 1 to operate with the subsystem clock. (in this case, subsystem clock generation must have been started.) after a time (15 machine cycles) required to switch to the subsystem clock elapses, bit 3 of the scc is set to 1 to terminate main system clock generation. <4> after detecting the input of commercial current by using an interrupt, bit 3 of the scc is cleared to start main system clock generation. after a time required for stable generation, bit 0 of the scc is cleared to 0 to operate at the highest speed. notes 1. the wait time is fixed to 56/f cc (28 m s at 2 mhz, 56 m s at 1 mhz) 2. int4 is useful. on off commercial power line voltage lowest-speed operation supply voltage v dd pin voltage reset signal system clock cpu clock wait note 1 f cc = 2 mhz f xt = 32.768 khz f cc 32 s f cc 2 s f xt 122 s f cc 2 s internal reset operation <1> <2> <3> <4>
100 m pd750108 user's manual 5.2.4 clock output circuit (1) configuration of the clock output circuit figure 5-20 shows the configuration of the clock output circuit. (2) functions of the clock output circuit the clock output circuit outputs a clock pulse from the p22/pcl pin and is applicable to a remote control waveform output or can be used to supply clock pulses to peripheral lsi devices. the procedure for outputting a clock pulse signal is as follows: (a) select a clock output frequency, and disable clock output. (b) write a 0 in the p22 output latch. (c) set the output mode for port 2. (d) enable clock output. figure 5-20. configuration of the clock output circuit remark the clock output circuit is designed so that pulses with short widths do not appear in enabling or disabling clock output. from the clock generator clom selector output buffer port 2 input/ output mode specification bit p22 output latch pcl/p22 internal bus 4 f f cc /2 3 f cc /2 4 f cc /2 6 port2.2 bit 2 of pmgb clom0 clom1 0 clom3
101 chapter 5 peripheral hardware functions (3) clock output mode register (clom) the clom is a 4-bit register to control clock output. the clom is set by a 4-bit memory manipulation instruction. example cpu clock f is output on the pcl/p22 pin. sel mb15 ; or clr1 mbe mov a,#1000b mov clom,a a reset signal clears the clom to 0, disabling clock output. figure 5-21. format of the clock output mode register caution be sure to write a 0 in bit 2 of the clom. address fd0h 3210 clom0 symbol clom f output note (250, 125, 62.5 15.6 khz) f cc /2 3 output (125 khz) f cc /2 4 output (62.5 khz) 0 0 1 0 0 1 1 1 clom1 0 clom3 f cc /2 6 output (15.6 khz) (f cc = 1 mhz) note f is the cpu clock selected by pcc. 0 1 output disable output enable clock output enable/disable bit f output note (500, 250, 125, 31.3 khz) f cc /2 3 output (250 khz) f cc /2 4 output (125 khz) f cc /2 6 output (31.3 khz) clock output frequency selection bit (f cc = 2 mhz) 0 0 1 0 0 1 1 1
102 m pd750108 user's manual (4) application to remote control waveform output the clock output function of the m pd750108 is applicable to remote control waveform output. the frequency of the carrier for remote control waveform output is selected by the clock frequency select bit of the clock output mode register. pulse output is enabled or disabled by controlling the clock output enable/disable bit by software. the clock output circuit is designed so that pulses with short widths do not appear in enabling or disabling clock output. figure 5-22. application to remote control waveform output pcl pin output bit 3 of clom
103 chapter 5 peripheral hardware functions 5.3 basic interval timer/watchdog timer the m pd750108 contains an 8-bit basic interval timer/watchdog timer, which has the following functions: (a) interval timer operation which generates a reference timer interrupt (b) operation as a watchdog timer for detecting program crashes and resetting the cpu (c) reading the count value 5.3.1 configuration of the basic interval timer/watchdog timer figure 5-23 shows the configuration of the basic interval timer/watchdog timer. figure 5-23. block diagram of the basic interval timer/watchdog timer note instruction execution 5.3.2 basic interval timer mode register (btm) the btm is a 4-bit register for controlling operation of the basic interval timer (bt). a 4-bit memory manipulation instruction is used to set the btm. bit 3 can be independently manipulated using a bit manipulation instruction. example the interrupt generation interval is set to 4.10 ms (at 2 mhz). sel mb15 ; or clr1 mbe mov a,#1111b mov btm,a ; btm 104 m pd750108 user's manual when bit 3 is set to 1, the bt is cleared, and the basic interval timer/watchdog timer interrupt request flag (irqbt) is also cleared (to start the basic interval timer/watchdog timer). a reset signal clears the interval timer to 0, and the longest interrupt request signal generation interval time is set. figure 5-24. format of the basic interval timer mode register address f85h 3210 btm3 btm2 btm1 btm0 symbol btm input clock specification 0 0 1 0 11 0 1 0 11 1 when 1 is written to this bit, the basic interval timer/watchdog timer operation starts (the counter and the interrupt request flag are cleared). when the operation starts, this bit is automatically reset to 0. basic interval timer/watchdog timer start control bit interrupt interval time f cc /2 12 (244 hz) f cc /2 9 (1.95 khz) f cc /2 7 (7.81 khz) f cc /2 5 (31.3 khz) 2 20 /f cc (1.05 s) 2 17 /f cc (131 ms) 2 15 /f cc (32.8 ms) 2 13 /f cc (8.19 ms) not to be set input clock specification 0 0 1 0 11 0 1 0 11 1 interrupt interval time f cc /2 12 (488 hz) f cc /2 9 (3.91 khz) f cc /2 7 (15.6 khz) f cc /2 5 (62.5 khz) 2 20 /f cc (524 ms) 2 17 /f cc (65.5 ms) 2 15 /f cc (16.4 ms) 2 13 /f cc (4.10 ms) not to be set (f cc = 2 mhz) (f cc = 1 mhz) other than above other than above
105 chapter 5 peripheral hardware functions 5.3.3 watchdog timer enable flag (wdtm) wdtm, when set, is a flag for enabling the generation of the reset signal when the basic interval timer overflows. wdtm is set by a bit manipulation instruction. it cannot be cleared by an instruction. example set the watchdog timer function. sel mb15 ; or clr1 mbe set1 wdtm set1 btm.3 ; set bit 3 of btm to 1 the generation of a reset signal clears wdtm to 0. figure 5-25. format of the watchdog timer enable flag (wdtm) 5.3.4 operation of the basic interval timer when wdtm is set to 0, the basic interval timer (bt) functions as an interval timer. an interrupt request flag (irqbt) is set when the timer overflows. bt is constantly incremented by the clock supplied from the clock generator. so it is impossible to stop the timer from incrementing. one of four interrupt generation intervals can be selected by setting btm. (see figure 5-24 .) bt and irqbt can be cleared by setting bit 3 of btm to 1 (instruction for starting as an interval timer). the count status of bt can be read by an 8-bit manipulation instruction. no data can be loaded to the timer. perform the timer operation as follows ( <1> and <2> can be performed with the same instruction): <1> set the interval in btm. <2> set 1 in bit 3 of btm. example generate an interrupt at intervals of 4.10 ms (at 2 mhz). set1 mbe sel mb15 mov a,#1111b mov btm,a ; set the interval and start processing ei ; enable interrupt ei iebt ; enable bt interrupt wdtm 0 1 bt mode sets irqbt when the basic interval timer (bt) overflows. wt mode generates an internal reset signal when the basic interval timer (bt) overflows. f8bh.3 address
106 m pd750108 user's manual 5.3.5 operation of the watchdog timer when wdtm is set to 1, the basic interval timer/watchdog timer functions as a watchdog timer. an internal reset signal is generated when the basic interval timer (bt) overflows. no reset signal, however, is generated during the oscillation settling time following the stop instruction has been released (wdtm cannot be cleared without using reset). bt is constantly incremented by the clock supplied from the clock generator. it cannot be stopped from counting. in the watchdog timer mode, program crashes are detected using the intervals at which bt overflows. the interval can be selected from among four values depending on bits 2 to 0 of btm (see figure 5-24 ). select an interval for detecting crashes according to the user system. a large program should be divided into modules each of which can be executed within the set interval. include an instruction which clears bt at the end of each module. if execution does not reach the instruction which clears bt within the set interval (in which case a program error leading to a program crash may have occurred), bt overflows and an internal reset signal is generated to forcibly terminate the program. the occurrence of internal reset possibly means that a program crash has occurred. a crash can thus be detected. set the watchdog timer as follows ( <1> and <2> can be performed with the same instruction): <1> set the interval in btm. <2> set 1 in bit 3 of btm. initial settings <3> set 1 in wdtm. <4> after <1> to <3> are set, set 1 in bit 3 of btm within each interval. example use the basic interval/watchdog timer as a watchdog timer with 16.4-ms interval (at 2 mhz) a program is divided into several modules each of which can be executed within the interval set in btm (16.4 ms). bt is cleared at the end of each module. if a program crash occurs, bt overflows and an internal reset signal is generated because bt is not cleared within the set interval. (from now on, 1 is set in bit 3 of btm at intervals of 16.4 ms.) set1 sel mov mov set1 mbe mb15 a, #1101b btm, a wdtm ; specifies a time interval and ; starts processing. ; enables the watchdog timer. initial setting:
107 chapter 5 peripheral hardware functions 5.3.6 other functions the basic interval timer/watchdog has the following functions regardless of whether it operates as a basic interval timer or watchdog timer: ? reading the count the count status of the basic interval timer (bt) can be read by using an 8-bit manipulation instruction. no data can be loaded to the timer. caution when reading the count value of bt, execute a read instruction twice so that unstable data which has been counted will not be read. if the two read values are reasonable, use the second one as the result. if the two read values are far apart, retry from the beginning. example read the count value of bt. set1 mbe sel mb15 mov hl, #bt ; set the bt address in hl loop: mov xa, @hl ; first read mov bc, xa mov xa, @hl ; second read ske xa, bc br loop module 1: set1 sel set1 mbe mb15 btm.3 processing completes within 16.4 ms. module 2: set1 sel set1 mbe mb15 btm.3 processing completes within 16.4 ms.
108 m pd750108 user's manual 5.4 clock timer the m pd750108 contains one clock timer, which has the following functions. (a) the clock timer sets the test flag (irqw) every 0.5 seconds (when wm0 = 1). the irqw can release the standby mode. (b) the subsystem clock (32.768 khz) can be used to produce 0.5-second intervals. (c) the fast-forward mode produces an interval 128 times faster, which is useful for program debugging and testing. (d) an arbitrary frequency note can be output to the p23/buz pin, so that it can be used for sounding the buzzer and for system clock frequency trimming. (e) the clock can be started from zero seconds by clearing the frequency divider. note 0.977, 1.953, or 15.625 khz (when the main system clock is running at 2 mhz) 0.488, 0.977, or 7.813 khz (when the main system clock is running at 1 mhz) 2.048, 4.096, or 32.768 khz (when the subsystem clock is running at 32.768 khz) caution set wm0 = 1 when using the clock function.
109 chapter 5 peripheral hardware functions 5.4.1 configuration of the clock timer figure 5-26 shows the configuration of the clock timer. figure 5-26. block diagram of the clock timer note when a frequency-divided main system clock is used, 32.768 khz cannot be selected as the source clock. remark the values in parentheses are for f cc = 1 mhz and f xt = 32.768 khz. 5.4.2 clock mode register the clock mode register (wm) is an 8-bit register which controls the clock timer. figure 5-27 shows the format of the clock mode register. all bits except bit 3 of the clock mode register are controlled by an 8-bit manipulation instruction. bit 3 is for testing the xt1 pin input level. the input level of the xt1 pin can be tested by bit test operation. no data can be written to this register. when the reset signal is generated, all bits except bit 3 of this register are cleared to 0. p23/buz internal bus 8 selector from the clock generator f cc 128 (7.8125 khz) f xt (32.768 khz) selector frequency divider selector intw irqw set signal wm7 0 wm5 wm4 wm3 wm2 wm1 wm0 p23 output latch bit 2 of pmgb port2.3 output buffer clear signal f w bit test instruction port 2 input/ output mode wm (4 khz) (2 khz) f w 2 7 f w 2 14 f w 2 3 f w 2 4 32.768 khz or 7.8125 khz note
110 m pd750108 user's manual example time is set using the subsystem clock (32.768 khz), and buzzer output is enabled: clr1 mbe mov xa, #85h mov wm, xa ; sets wm figure 5-27. clock mode register format remark ( ) for f w = 32.768 khz address f98h symbol wm 0 wm0 1 wm1 2 wm2 3 wm3 4 wm4 5 wm5 6 0 7 wm7 wm0 0 1 selects divided system clock output: selects subsystem clock: f xt count clock (f w ) selection bit wm1 0 1 normal clock mode ( : sets irqw at 0.5 s) advanced clock mode ( : sets irqw at 3.91 ms) operation mode selection bit clock operation enable/disable bit xt1 pin input level (bit test only) wm5 wm4 0 buz output frequency (2.048 khz) (4.096 khz) (32.768 khz) buz output frequency selection bit wm7 0 1 disables buz output enables buz output wm3 0 1 input to the xt1 pin is low level input to the xt1 pin is high level wm2 0 1 disables clock operation (clears the frequency dividing circuit) enables clock operation buz output enable/disable bit 1 0 not to be set 1 f w 0 0 1 1 f w 2 14 f cc 128 f w 2 7 f w 2 4 f w 2 3
111 chapter 5 peripheral hardware functions 5.5 timer/event counter the m pd750108 has one timer/event counter channel (channel 0) and one timer counter channel (channel 1). figures 5-28 and 5-29 show the configuration of these channels. in this section, the timer/event counter and timer counters are referred to as "timer/event counters." when you read this section for description of channel 1, take "timer/event counter" as "timer counter." the timer/event counter has the following functions. (a) programmable interval timer operation (b) square wave output of any frequency to the pton pin (n = 0, 1) (c) event counter operation (channel 0 only) (d) divides the frequency of signal input via the ti0 pin to 1-nth of the original signal and outputs the divided frequency to the pto0 pin (frequency divider operation) (channel 0 only). (e) supplies the shift clock to the serial interface circuit (channel 0 only). (f) read function for the count value 5.5.1 configuration of timer/event counter figures 5-28 and 5-29 shows the configuration of the timer/event counter.
112 m pd750108 user's manual figure 5-28. block diagram of the timer/event counter (channel 0) count register (8) ti0/p13 f cc /2 4 f cc /2 6 f cc /2 8 f cc /2 10 mpx timer operation start signal 8 8 8 from the clock generator internal bus tm06 tm05 tm04 tm03 tm02 port input buffer comparator (8) modulo register (8) to enable flag p20 output latch signal port 2 input/ output mode clear signal t0 tmod0 bit 2 of pmgb pto0/p20 output buffer reset reset irqt0 clear signal tout flip-flop tm0 set1 note input buffer irqt0 set signal intt0 port2.0 toe0 to serial interface cp match 8 8 tout0 note execution of the instruction
113 chapter 5 peripheral hardware functions figure 5-29. block diagram of the timer counter (channel 1) count register (8) mpx timer operation start signal 8 8 8 from the clock generator internal bus tm16 tm15 tm14 tm13 tm12 comparator (8) modulo register (8) to enable flag p21 output latch signal port 2 input/ output mode clear signal t1 tmod1 bit 2 of pmgb pto1/p21 output buffer reset reset irqt1 clear signal tout flip-flop tm1 set1 note irqt1 set signal intt1 port2.1 toe1 cp match 8 8 f cc /2 6 f cc /2 8 f cc /2 10 f cc /2 12 note execution of the instruction
114 m pd750108 user's manual (1) timer/event counter mode register (tm0, tm1) the timer/event counter mode register (tm0, tm1) is an 8-bit register which controls the timer/event counter. its format is shown in figures 5-30 and 5-31. the timer/event counter mode register is set by an 8-bit memory manipulation instruction. bit 3 is a timer start bit and can be operated bit-wise. it is automatically reset to 0 when the timer operation starts. all the bits of the timer/event counter mode register are cleared to 0 by a reset signal generation. examples 1. start the timer in the interval timer mode of cp = 1.95 khz (during 2 mhz operation). sel mb15 ; or clr1 mbe mov xa, #01001100b mov tmn, xa ; tmn 115 chapter 5 peripheral hardware functions figure 5-30. timer/event counter mode register (channel 0) format when f cc = 1 mhz tm05 0 0 0 0 1 1 tm06 0 0 1 1 1 1 tm04 0 1 0 1 0 1 ti0 rising edge ti0 falling edge f cc /2 10 (977 hz) f cc /2 8 (3.91 khz) f cc /2 6 (15.6 khz) f cc /2 4 (62.5 khz) not to be set count pulse (cp) other than above address fa0h 76 tm06 5 tm05 4 tm04 3 tm03 2 tm02 1 0 symbol tm0 tm03 timer start indication bit when 1 is written into the bit, the counter and irqt0 flag are cleared. if bit 2 is set to 1, count operation is started. tm02 0 1 operation mode stop (retention of count contents) count operation count operation count pulse (cp) selection bit when f cc = 2 mhz tm05 0 0 0 0 1 1 tm06 0 0 1 1 1 1 tm04 0 1 0 1 0 1 ti0 rising edge ti0 falling edge f cc /2 10 (1.95 khz) f cc /2 8 (7.81 khz) f cc /2 6 (31.3 khz) f cc /2 4 (125 khz) not to be set count pulse (cp) other than above
116 m pd750108 user's manual figure 5-31. timer counter mode register (channel 1) format address fa8h 76 tm16 5 tm15 4 tm14 3 tm13 2 tm12 1 0 symbol tm1 tm13 timer start indication bit when 1 is written into the bit, the counter and irqt1 flag are cleared. if bit 2 is set to 1, count operation is started. tm12 0 1 operation mode stop (retention of count contents) count operation count operation other than above other than above when f cc = 1 mhz tm15 0 0 0 1 1 tm16 0 1 1 1 1 tm14 0 0 1 0 1 rising edge of intw (overflow output for clock timer) f cc /2 12 (244 hz) f cc /2 10 (977 hz) f cc /2 8 (3.91 khz) f cc /2 6 (15.6 khz) not to be set count pulse (cp) count pulse (cp) select bit when f cc = 2 mhz tm15 0 0 0 1 1 tm16 0 1 1 1 1 tm14 0 0 1 0 1 rising edge of intw (overflow output for clock timer) f cc /2 12 (488 hz) f cc /2 10 (1.95 khz) f cc /2 8 (7.81 khz) f cc /2 6 (31.3 khz) not to be set count pulse (cp)
117 chapter 5 peripheral hardware functions (2) timer/event counter output enable flag (toe0, toe1) the timer/event counter output enable flag (toe0, toe1) controls the output enable/disable to the pto0 and pto1 pins in the timer out flip-flop (tout flip-flop) status. the timer out flip-flop is inverted by the match signal sent from the comparator. when bit 3 of the timer/ event counter mode register (tm0, tm1) is set to 1, the timer out flip-flop is cleared to 0. toe0, toe1, and timer out flip-flop are cleared to 0 by a reset signal generation. figure 5-32. timer/event counter output enable flag format 5.5.2 8-bit timer/event counter mode operation it is used as an 8-bit timer/event counter in this mode. it performs an 8-bit programmable interval timer and event counter operation (channel 0 only). (1) register setting the following three registers and one flag are used in the 8-bit timer/event counter mode. ? timer/event counter mode register (tmn) ? timer/event counter count register (tn) ? timer/event counter modulo register (tmodn) ? timer/event counter output enable flag (toen) (a) timer/event counter mode register (tmn) when the 8-bit timer/event counter mode is used, tmn must be set as shown in figure 5-33 (for the format of the tmn, see figures 5-30 and 5-31). the tmn is manipulated by an 8-bit manipulation instruction. bit 3 is a timer start indication bit and can be manipulated bit-wise and is automatically cleared to 0 when the timer starts. the tmn is cleared to 00h when an internal reset signal is generated. remark n = 0, 1 address fa2h faah toe0 toe1 channel 0 channel 1 0 1 disabled. enabled. timer/event counter output enable flag (w)
118 m pd750108 user's manual figure 5-33. timer/event counter mode register setup (1/2) (a) in the case of timer/event counter (channel 0) timer start indication bit when 1 is written into the bit, the counter and irqt0 flag are cleared. if bit 2 is set to 1, count operation is started. tm03 tm02 operation mode count operation 0 1 stop (retention of count contents) count operation 76 tm06 5 tm05 4 tm04 3 tm03 2 tm02 10 address fa0h symbol tm0 count pulse (cp) selection bit ti0 rising edge ti0 falling edge f cc /2 10 f cc /2 8 f cc /2 6 f cc /2 4 not to be set tm05 0 0 0 0 1 1 tm06 0 0 1 1 1 1 tm04 0 1 0 1 0 1 count pulse (cp) other than above
119 chapter 5 peripheral hardware functions figure 5-33. timer/event counter mode register setup (2/2) (b) in the case of timer counter (channel 1) (b) timer/event counter output enable flag (toen) the toen is manipulated by a bit manipulation instruction. the toen is cleared to 0 by an internal reset signal. figure 5-34. timer/event counter output enable flag setup timer start indication bit when 1 is written to the bit, the counter and irqt1 flag are cleared. if bit 2 is set to 1, count operation is started. tm13 tm12 operation mode count operation other than above 0 1 stop (retention of count contents) count operation 76 tm16 5 tm15 4 tm14 3 tm13 2 tm12 1 0 address fa8h symbol tm1 count pulse (cp) selection bit rising edge of intw (overflow output for clock timer) f cc /2 12 f cc /2 10 f cc /2 8 f cc /2 6 not to be set tm15 0 0 0 1 1 tm16 0 1 1 1 1 tm14 0 0 1 0 1 count pulse (cp) address fa2h faah toe0 toe1 channel 0 channel 1 0 1 disabled (outputs the low-level signal). enabled. timer/event counter output enable flag (w)
120 m pd750108 user's manual (2) timer/event counter time setting [timer setup time] (cycle) is found by dividing [modulo register contents + 1] by [count pulse (cp) frequency] selected by setting the mode register. n+1 t (sec) = = (n + 1) (resolution) f cp t (sec) : timer setup time (seconds) f cp (hz) : count pulse frequency (hz) n : modulo register content (n 1 0) once the timer is set, interrupt request signal (irqt0, irqt1) is generated at the intervals set in the timer. table 5-6 lists the resolution and longest setup time (time when ffh is set in the modulo register) for each count pulse to the timer/event counter. table 5-6. resolution and longest setup time (a) when timer/event counter (channel 0) mode register at 2 mhz at 1 mhz tm06 tm05 tm04 resolution longest setup time resolution longest setup time 1 0 0 512 m s 131 ms 1024 m s 262 ms 1 0 1 128 m s 32.8 ms 256 m s 65.5 ms 1 1 0 32 m s 8.19 ms 64 m s 16.4 ms 111 8 m s 2.05 ms 16 m s 4.10 ms (b) when timer counter (channel 1) mode register at 2 mhz at 1 mhz tm16 tm15 tm14 resolution longest setup time resolution longest setup time 1 0 0 2048 m s 524 ms 4096 m s 1049 ms 1 0 1 512 m s 131 ms 1024 m s 262 ms 1 1 0 128 m s 32.8 ms 256 m s 65.5 ms 1 1 1 32 m s 8.19 ms 64 m s 16.4 ms
121 chapter 5 peripheral hardware functions (3) timer/event counter operation the timer/event counter operates as follows. figure 5-35 shows the configuration of the timer/event counter. <1> the count pulse (cp) is selected by setting the timer/event counter mode register (tmn) and is input to the timer/event counter count register (tn). <2> the tn is compared with the timer/event counter modulo register (tmodn), and if they are equal, a match signal is generated and the interrupt request flag (irqtn) is set. at the same time, the timer out flip-flop (tout flip-flop) is inverted. figure 5-36 is a timing chart of the timer/event counter. the timer/event counter normally begins operation in the following procedure. <1> set a count in the tmodn. <2> set the operating mode, count pulse, and start indication in the tmn. caution set a value other than 00h in the modulo register (tmodn). when using the timer/event counter output pin (pton), set the dual function pin p2n as follows. <1> clear the output latch of p2n. <2> set port 2 to the output mode. <3> make a status wherein the internal pull-up resistor is not connected in port 2. <4> set the timer/event counter output enable flag (toen) to 1. remark n = 0, 1 figure 5-35. configuration of timer/event counter note channel 0 of the timer/event counter only. modulo register (tmodn) comparator count register (tn) match clear tout flip-flop to serial interface note pton inttn (irqtn set signal) mpx cp ti0 note internal clock tout0
122 m pd750108 user's manual figure 5-36. count operation timing remark m : set value of the modulo register n : 0, 1 (4) applications of the timer/event counter (a) timer/event counter is used as an interval timer that generates interrupts at intervals of 30 ms. ? the high-order four bits of the timer/event counter mode register are set to 0100b to select maximum set time 131 ms (at 2 mhz). ? the low-order four bits of the timer/event counter mode register are set to 1100b. ? the timer/event counter modulo register is set to the following value: 30 ms/512 m s = 58.6 = . . 3bh sel mb15 mov xa,#3bh mov tmod0,xa ; set the modulo register mov xa,#01001100b mov tm0,xa ; set the mode register and start the timer ei ; enable an interrupt ei iet0 ; enable a timer interrupt remark in this application, the ti0 pin can be used as an input pin. (b) an interrupt is caused when the number of pulses (active high) applied to the ti0 pin reaches 100. ? the high-order four bits of the timer/event counter mode register are set to 0000 to select the rising edge. ? the low-order four bits of the timer/event counter mode register are set to 1100b. ? the timer/event counter modulo register is set to 99 = 100 C 1. modulo register (tmodn) count register (tn) tout flip-flop count pulse (cp) reset timer start indication match match m 0 1 2 mC1 0 1 2 m mC1 0 1 2 m34
123 chapter 5 peripheral hardware functions sel mb15 mov xa,#100 C 1 mov tmod0,xa ; set the modulo register mov xa,#00001100b mov tm0,xa ; set the mode register ei ei iet0 ; enable intt0 5.5.3 notes on timer/event counter applications (1) time error at the start of the timer a maximum error of one count pulse (cp) cycle from a value calculated according to section 5.5.2 (2) occurs in a time period from the start of the timer (bit 3 of the tm0 is set) to the generation of a match signal. this is because the count register t0 is cleared not in phase with the cp as shown in figure 5-37. figure 5-37. error at the start of the timer (2) notes on the start of the timer usually, when the timer is started (bit 3 of the tm0 is set), the count register t0 and the interrupt request flag (irqt0) are cleared. however, when the timer is placed in the operation mode, and the setting of irqt0 and the start of the timer occur at the same time, irqt0 may not be cleared. this causes no problem if irqt0 is used for a vectored interrupt. however, if irqt0 is being tested, a problem arises because irqt0 is set even if the timer is started. accordingly, in a situation where the timer is started on such timing that irqt0 may be set, the timer must be restarted after it is once stopped (bit 2 of the tm0 is cleared to 0), or timer start operation must be performed twice. example the timer is started on such timing that irqt0 may be set. sel mb15 mov xa,#0 mov tm0,xa ; stop the timer mov xa,#4ch mov tm0,xa ; restart or sel mb15 set1 tm0.3 set1 tm0.3 ; restart cp count register timer start timer start 01 23 012
124 m pd750108 user's manual (3) error in reading the count register the contents of the count register can be read using an 8-bit data memory manipulation instruction at any time. during operation by such an instruction, all count pulse changes are held not to change the count register. this means that if the count pulse signal source is applied to the ti0 input, as many count pulses as corresponding to the time required to execute the instruction are cut. (when an internal clock is used for the count pulse signal, this problem does not occur because of synchronization with the instruction.) accordingly, in an attempt to read the contents of the count register with a count pulse signal applied to ti0, the signal must have a pulse wide enough to avoid incorrect counting even if count pulses are cut. that is, the contents of the count register are held by a read instruction for one machine cycle, so that a signal applied to the ti0 pin must have a pulse wider than that. (4) notes on changing the count pulse when the count pulse is changed by rewriting the contents of the timer/event counter mode register, this takes effect immediately after the rewrite instruction is executed. a combination of clocks used for changing count pulse signals can generate a spike ( <1> or <2> ) count pulse as shown in the figure below. in this case, an incorrect count operation may occur, or the contents of the count register may be destroyed. so when the count pulse is changed, bit 3 of the timer/event counter mode register must be set to 1, and the timer must be restarted at the same time. external clock (ti0) instruction cp count register k C 1 k k + 1 k + 2 read instruction a change in a count pulse is placed on hold by the instruction. a count pulse is canceled by the instruction. re-set instruction re-set instruction clock a specified clock b specified clock a specified clock a clock b cp
125 chapter 5 peripheral hardware functions (5) operation after the modulo register is changed the contents of the modulo register are changed when an 8-bit data memory manipulation instruction is executed. if the new value of the modulo register is less than the value of the count register, the count register continues count operation until it overflows, then it restarts count operation from 0. accordingly, if the new value (m) of the modulo register is less than the value (n) before it is changed, the timer must be restarted after the contents of the modulo register are changed. re-set instruction re-set instruction clock a specified clock b specified clock a specified clock a clock b cp <1> <2> re-set instruction nm n0 1 m 0 match signal match signal modulo register count register cp nm x C 1 x 255 0 1 n > x > m modulo register count register cp
126 m pd750108 user's manual 5.6 serial interface 5.6.1 serial interface functions the m pd750108 contains a clock synchronous 8-bit serial interface, which has four modes. the functions of the four modes are outlined below. (1) operation halt mode this mode is used when serial transfer is not performed. this mode reduces power consumption. (2) three-wire serial i/o mode in this mode, 8-bit data is transferred through three lines: serial clock (sck), serial output (so), and serial input (si). the three-wire serial i/o mode allows full-duplex transmission, so data transfer can be performed at higher speed. the user can choose 8-bit data transfer starting with the msb or lsb, so devices starting with either the msb or lsb can be connected. the three-wire serial i/o mode enables connections to be made with the 75xl series, 78k series, and many other types of peripheral i/o devices. (3) two-wire serial i/o mode in this mode, 8-bit data is transferred through two lines: serial clock (sck) and serial data bus (sb0 or sb1). by controlling output levels on the two lines by software, communication with multiple devices is enabled. the output levels of sck and sb0 (or sb1) can be controlled by software, so the user can match an arbitrary transfer format. this means that a line that has been required for handshaking to connect multiple lines can be eliminated for more efficient input/output port utilization. (4) serial bus interface (sbi) mode in this mode, communication with multiple devices can be performed using two lines: serial clock (sck) and serial data bus (sb0 or sb1). this mode conforms to the nec serial bus format. in this mode, the transmitter can output, on the serial data bus, an address for selecting a device subject to serial communication, commands directed to the remote device, and data. the receiver can identify an address, commands, and data from received data by hardware. this function enables more efficient input/output port utilization as in the case of the two-wire serial i/o mode. in addition, this function can simplify the serial interface control portion of an application program.
127 chapter 5 peripheral hardware functions figure 5-38. example of the sbi system configuration 5.6.2 configuration of serial interface figure 5-39 shows the block diagram of the serial interface. sck master cpu sb0, sb1 sck sb0, sb1 slave cpu #1 address 1 sck sb0, sb1 slave ic #n address n address command data serial clock v dd
128 m pd750108 user's manual figure 5-39. block diagram of the serial interface internal bus 8 8 8 8/4 p03/si/sb1 p02/so/sb0 p01/sck (8) f cc /2 3 f cc /2 4 f cc /2 6 tout0 (from timer/event counter) csim reld cmdd ackd ackt acke bsye relt cmdt dq set clr (8) (8) sbic bit test slave address register (sva) address comparator match signal bit manipulation so latch bit test selec- tor selec- tor busy/ acknowledge output circuit bus release/ command/ acknowledge detection circuit serial clock counter serial clock control circuit intcsi control circuit irqcsi set signal intcsi p01 output latch serial clock selector external sck shift register (sio)
129 chapter 5 peripheral hardware functions (1) serial operation mode register 0 (csim) csim is an 8-bit register which specifies a serial interface operation mode, serial clock, wake-up function, and so forth. (see (1) in section 5.6.3 for details.) (2) serial bus interface control register (sbic) sbic is an 8-bit register consisting of bits for controlling the serial bus and flags for indicating the states of input data from the serial bus. sbic is used mainly in the sbi mode. (see (2) in section 5.6.3 for details.) (3) shift register (sio) sio is an 8-bit register which converts 8-bit serial data to parallel data, and 8-bit parallel data to serial data. sio performs transfer (shift) in phase with the serial clock. transfers operations are controlled by writing data to sio. (see (3) in section 5.6.3 for details.) (4) so latch so is a latch to hold the levels of pins so and sb0, or si and sb1, which can be controlled directly by software. in the sbi mode, so is set when the eighth clock of sck has been output. (see (2) in section 5.6.3 for details.) (5) serial clock selector the serial clock selector selects the serial clock to be used. (6) serial clock counter the serial clock counter counts the serial clock to be output or input during transfer, and checks whether 8-bit data has been transferred. (7) slave address register (sva) and address comparator ? in the sbi mode sva is used when the m pd750108 is used as a slave device. a slave sets the number assigned to it (slave address) in sva. the master outputs a slave address to select a particular slave. two data values (a slave address output from the master and the value of sva) are compared with each other by the address comparator. if a match is found, the slave is selected. in the two-wire serial i/o mode or sbi mode sva detects an error when data is transferred with the m pd750108 operating as the master or a slave. (see (4) in section 5.6.3 for details.) (8) intcsi control circuit the intcsi control circuit controls interrupt request processing. the circuit issues an interrupt request (intcsi), and set an interrupt request flag (irqcsi) in the following cases. (see figure 6-1 .) ? in the three-wire or two-wire serial i/o mode an interrupt request is issued whenever eight serial clocks are counted. ? in the sbi mode when wup7 note = 0, an interrupt request is issued whenever eight serial clocks are counted. when wup = 1, an interrupt request is issued when values of sva and sio match after an address is received. note wup: wake-up function specification bit (bit 5 of csim)
130 m pd750108 user's manual (9) serial clock control circuit the serial clock control circuit controls the serial clock to be supplied to the shift register, or controls the clock to be output to the sck pin when the internal system clock is used. (10) busy/acknowledge output circuit and bus release/command/acknowledge detection circuit the busy/acknowledge output circuit and bus release/command/acknowledge detection circuit output and detect control signals generated in the sbi mode. these circuits do not operate in the three-wire or two-wire serial i/o mode. (11) p01 output latch the p01 output latch generates serial clock by software after the eighth serial clock has been output. when the reset signal is entered, this latch is set to 1. to select the internal system clock as the serial clock, set the p01 output latch to 1. 5.6.3 register functions (1) serial operation mode register (csim) figure 5-40 shows the format of serial operation mode register (csim). csim is an 8-bit register which specifies a serial interface operation mode, serial clock, wake-up function, and so forth. csim is manipulated using an 8-bit memory manipulation instruction. the higher three bits can be manipulated bit by bit. each bit can be manipulated using its name. each bit may or may not allow read and/or write operation (see figure 5-40 ). bit 6 allows bit test operation only; any data written to this bit is invalid. when the reset signal is generated, all bits are cleared to 0. figure 5-40. format of serial operation mode register (csim) (1/4) remarks 1. (r) : read only 2. (w): write only csie coi wup csim4 csim3 csim1 csim2 csim0 76543 1 20 address csim symbol serial clock selection bit (w) fe0h serial interface operation enable/disable specification bit (w) serial interface operation mode selection bit (w) wake-up function specification bit (w) signal from address comparator (r)
131 chapter 5 peripheral hardware functions figure 5-40. format of serial operation mode register (csim) (2/4) serial interface operation enable/disable specification bit (w) shift register serial clock irqcsi so/sb0 and operation counter flag si/sb1 pins csie 0 shift operation cleared held used only for port 0 disabled 1 shift operation count operation can be set. used in each mode as well enabled as for port 0 signal from address comparator (r) coi note condition for being cleared (coi = 0) condition for being set (coi = 1) when the data in the slave address when the data in the slave address register register (sva) does not match the data (sva) matches the data in the shift in the shift register register note coi can be read only before serial transfer is started or after serial transfer is completed. an undefined value may result during transfer. coi data written by an 8-bit manipulation instruction is ignored. wake-up function specification bit (w) wup 0 sets irqcsi each time serial transfer is completed in each mode. 1 used in the sbi mode only to set irqcsi only when an address received after bus release matches the data in the slave address register (wake-up state). sb0 or sb1 goes to high- impedance state. caution when wup = 1 is set during busy signal output, busy is not released. in the sbi mode, the busy signal is output until the next falling edge of the serial clock (sck) appears after release of busy is directed. before setting wup = 1, be sure to confirm that pin sb0 (or sb1) is high after releasing busy.
132 m pd750108 user's manual figure 5-40. format of serial operation mode register (csim) (3/4) serial interface operation mode selection bit (w) csim4 csim3 csim2 operation bit order of p02/so/sb0 pin p03/si/sb1 pin mode shift register function function x 0 0 3-wire sio 7-0 <> xa so (cmos output) si (cmos input) serial (transfer starting i/o mode with msb) 1 sio 0-7 <> xa (transfer starting with lsb) 0 1 0 sbi mode sio 7-0 <> xa sb0 p03 (cmos input) (transfer starting (n-ch open-drain i/o) 1 with msb) p02 (cmos input) sb1 (n-ch open-drain i/o) 0 1 1 2-wire sio 7-0 <> xa sb0 p03 (cmos input) serial (transfer starting (n-ch open-drain i/o) 1 i/o mode with msb) p02 (cmos input) sb1 (n-ch open-drain i/o) remark x: dont care serial clock selection bit (w) csim1 csim0 serial clock sck pin mode 3-wire serial i/o mode sbi mode 2-wire serial i/o mode 0 0 input clock externally applied to sck pin input 0 1 timer/event counter output (tout0) output 10f cc /2 4 (125 khz: during 2-mhz operation, f cc /2 6 62.5 khz: during 1-mhz operation) (31.3 khz: during 2-mhz 11f cc /2 3 (250 khz: during 2-mhz operation, operation, 125 khz: during 1-mhz operation) 15.6 khz: during 1-mhz operation) remarks 1. each mode can be selected using csie, csim3, and csim2. csie csim3 csim2 operation mode 0 x x operation halt mode 1 0 x three-wire serial i/o mode 1 1 0 sbi mode 1 1 1 two-wire serial i/o mode
133 chapter 5 peripheral hardware functions figure 5-40. format of serial operation mode register (csim) (4/4) remarks 2. the p01/sck pin assumes any of the following states according to the state of csie, csim1, and csim0: csie csim1 csim0 p01/sck pin state 0 0 0 input port (p01) 1 0 0 high impedance (sck input) 0 0 1 high level output 010 011 1 0 1 serial clock output (high level output: 110 upon completion of serial transfer) 111 3. when clearing csie during serial transfer, use the following procedure: <1> disable interrupts by clearing the interrupt enable flag (iecsi). <2> clear csie. <3> clear the interrupt request flag (irqcsi). examples 1. f cc /2 4 is selected as the serial clock, serial interrupt irqcsi, is generated each time serial transfer is completed, and serial transfer is performed in the sbi mode with the sb0 pin used as the serial data bus. sel mb15 ; or clr1 mbe mov xa,#10001010b mov csim,xa ; csim 134 m pd750108 user's manual (2) serial bus interface control register (sbic) figure 5-41 shows the format of the serial bus interface control register (sbic). sbic is an 8-bit register consisting of bits for controlling the serial bus and flags for indicating the states of input data from the serial bus. sbic is used mainly in the sbi mode. sbic is manipulated using a bit manipulation instruction. sbic cannot be manipulated using a 4-bit or 8-bit memory manipulation instruction. each bit may or may not allow read and/or write operation ( figure 5-41 ). when the reset signal is generated, all bits are cleared to 0. caution only the following bits can be used in the three-wire and two-wire serial i/o modes: ? bus release trigger bit (relt): sets the so latch. ? command trigger bit (cmdt): clears the so latch . figure 5-41. format of serial bus interface control register (sbic) (1/3) remarks 1. (r): read only 2. (w): write only 3. (r/w): read/write bsye ackd acke ackt cmdd cmdt reld relt 76543 1 20 address sbic symbol bus release trigger bit (w) fe2h command trigger bit (w) bus release detection flag (r) command detection flag (r) acknowledge trigger bit (w) acknowledge enable bit (r/ w) acknowledge detection flag (r) busy enable bit (r/ w)
135 chapter 5 peripheral hardware functions figure 5-41. format of serial bus interface control register (sbic) (2/3) busy enable bit (r/w) bsye 0 <1> the busy signal is automatically disabled. <2> busy signal output is stopped in phase with the falling edge of sck immediately after clear instruction execution. 1 the busy signal is output after the acknowledge signal in phase with the falling edge of sck. acknowledge detection flag (r) ackd condition for being cleared (ackd = 0) condition for being set (ackd = 1) <1> the transfer operation is started. the acknowledge signal (ack) is detected <2> the reset signal is generated. (in phase with the rising edge of sck). acknowledge enable bit (r/w) acke 0 disables automatic output of the acknowledge signal (ack). (output by ackt is possible.) 1 when set before transfer ack is output in phase with the 9th clock of sck. when set after transfer ack is output in phase with sck immediately following the set instruction execution. acknowledge trigger bit (w) ackt when set after transfer, ack is output in phase with the next sck. after ack signal output, this bit is automatically cleared to 0. cautions 1. never set ackt before or during serial transfer. 2. ackt cannot be cleared by software. 3. before setting ackt, set acke = 0. command detection flag (r) cmdd condition for being cleared (cmdd = 0) condition for being set (cmdd = 1) <1> the transfer start instruction is executed. the command signal (cmd) is detected. <2> the bus release signal (rel) <3> the reset signal is generated. <4> csie = 0 (see figure 5-40 .)
136 m pd750108 user's manual figure 5-41. format of serial bus interface control register (sbic) (3/3) bus release detection flag (r) reld condition for being cleared (reld = 0) condition for being set (reld = 1) <1> the transfer start instruction is executed. the bus release signal (rel) is detected. <2> the reset signal is generated. <3> csie = 0 (see figure 5-40 .) <4> sva does not match sio when an address is received. command trigger bit (w) cmdt control bit for command signal (cmd) trigger output. by setting cmdt = 1, the so latch is cleared. then the cmdt bit is automatically cleared to 0. caution never clear sb0 (or sb1) during serial transfer. be sure to clear sb0 (or sb1) before or after serial transfer bus release trigger bit (w) relt control bit for bus release signal (rel) trigger output. by setting relt = 1, the so latch is set to 1. then the relt bit is automatically cleared to 0. caution never clear sb0 (or sb1) during serial transfer. be sure to clear sb0 (or sb1) before or after serial transfer. examples 1. a command signal is output. sel mb15 ; or clr1 mbe set1 cmdt 2. reld and cmdd are tested to identify the types of received data and the types of processing accordingly. by setting wup = 1, this interrupt routine is processed only when an address match is found. sel mb15 skf reld ; reld test br !adrs skt cmdd ; cmdd test br !data br !cmd cmd: ...................... ; command analysis data: ..................... ; data processing adrs: .................... ; address decode
137 chapter 5 peripheral hardware functions (3) shift register (sio) figure 5-42 shows the configuration of peripheral hardware of shift register. sio is an 8-bit register which performs parallel-serial conversion and serial transfer (shift) operation in phase with the serial clock. serial transfer is started by writing data to sio. in transmission, data written to sio is output on the serial output (so) or serial data bus (sb0 or sb1). in receive operation, data is read from the serial input (si) or sb0 or sb1 into sio. data can be read from or written to sio by using an 8-bit manipulation instruction. when the reset signal is generated during operation, the value of sio is undefined. when the reset signal is generated in the standby mode, the value of sio is preserved. shift operation is stopped after 8-bit send or receive operation is completed. figure 5-42. peripheral hardware of shift register the timing for reading sio and start of serial transfer (writing to sio) is as follows: ? when the serial interface operation enable/disable bit (csie) = 1. however, the case where csie is set to 1 after data is written to the shift register is excluded. ? when the serial clock is masked after 8-bit serial transfer ? sck is high. when reading from or writing to sio, make sure that sck is high. in the two-wire serial i/o mode and sbi mode, the pins specified for the data bus are used for both input and output. because the configuration of output pins is n-ch open-drain, write ffh in sio for devices that are to receive data. (4) slave address register (sva) the slave address register (sva) is an 8-bit register for a slave to set its slave address (number assigned to it). sva is manipulated using an 8-bit manipulation instruction. when the reset signal is generated, the value of sva is undefined. however, the value of sva is preserved when the reset signal is generated in the standby mode. sva has the following two functions: dq set clr relt cmdt clk busy/ack internal bus address comparator shift register so latch shift clock n-ch open-drain output csim
138 m pd750108 user's manual (a) slave address detection [in the sbi mode] sva is used when the m pd750108 is connected as a slave device to the serial bus. sva is an 8- bit register for a slave to set its slave address (number assigned to it). the master outputs a slave address to the connected slaves to select a particular slave. two data values (a slave address output from the master and the value of sva) are compared with each other by the address comparator. if a match is found, the slave is selected. at this time, bit 6 (coi) of serial operation mode register (csim) is set to 1. if a match with received address data is not found, the bus release detection flag (reld) is cleared to 0. when wup = 1 (wake-up state detection), irqcsi is set only when a match is found. with this interrupt request, the m pd750108 can be informed of a communication request transmitted from the master. (b) error detection [in the two-wire serial i/o mode or sbi mode] sva detects an error when addresses, commands, or data is transferred with the m pd750108 operating as the master or when data is transferred with the m pd750108 operating as a slave. (for details, see (6) in section 5.6.6 and (8) in section 5.6.7 .) 5.6.4 operation halt mode the operation halt mode is used when serial transfer is not performed. this mode reduces power consumption. the shift register does not perform shift operation in this mode, so the shift register can be used as a normal 8-bit register. when the reset signal is entered, the operation halt mode is set. the p02/so/sb0 pin and p03/si/sbi pin function as input-only port pins. the p01/sck pin can be used as an input port pin by setting the serial operation mode register. (1) register setting to set the operation halt mode, manipulate serial operation mode register (csim). (for details on csim format, see (1) in section 5.6.3 .) csim is manipulated with an 8-bit manipulation instruction. only the csie bit of csim can be independently manipulated. csim can also be manipulated using the name of each bit. when the reset signal is entered, csim is set to 00h. in the figure below, hatched portions indicate bits used in the operation halt mode.
139 chapter 5 peripheral hardware functions note the status of the p01/sck pin is selectable. remark (r): read only (w): write only serial interface operation enable/disable specification bit (w) shift register operation serial clock counter irqcsi flag so/sb0 and si/sb1 pins csie0 0 shift operation disabled cleared held used only for port 0 serial clock selection bit (w) the p01/sck pin assumes the following state according to the setting of csim0 and csim1: csim1 csim0 p01/sck pin state 0 0 high impedance 0 1 high level output 10 11 when clearing csie during serial transfer, use the following procedure: <1> disable interrupts by clearing the interrupt enable flag (iecsi). <2> clear csie. <3> clear the interrupt request flag (irqcsi). csie coi wup csim4 csim3 csim2 csim1 csim0 fe0h csim 76543210 address serial clock selection bit (w) note serial interface operation mode selection bit (w) wake-up function specification bit (w) match signal from address comparator (r) serial interface operation enable/disable specification bit (w)
140 m pd750108 user's manual 5.6.5 three-wire serial i/o mode operations the three-wire serial i/o mode is compatible with other modes used in the 75xl series, 75x series, m pd7500 series, and 87ad series. communication is performed using three lines: serial clock (sck), serial output (so), and serial input (si). figure 5-43. example of three-wire serial i/o system configuration remark the m pd750108 can also be used as a slave cpu. (1) register setting to set the three-wire serial i/o mode, manipulate the following two registers: ? serial operation mode register (csim) ? serial bus interface control register (sbic) (a) serial operation mode register (csim) to use the three-wire serial i/o mode, set csim as shown below. (for details on csim format, see (1) in section 5.6.3 .) csim0 is manipulated using an 8-bit manipulation instruction. bits 7, 6, and 5 of csim can be manipulated bit by bit. when the reset signal is input, csim is set to 00h. in the figure below, hatched portions indicate the bits used in the three-wire serial i/o mode. remark (r): read only (w): write only csie coi wup csim4 csim3 csim2 csim1 csim0 fe0h csim 76543210 address serial clock selection bit (w) serial interface operation mode selection bit (w) wake-up function specification bit (w) match signal from address comparator (r) serial interface operation enable/disable specification bit (w) sck master cpu pd750108 so si slave cpu sck si so 3-wire serial i/o 3-wire serial i/o
141 chapter 5 peripheral hardware functions serial interface operation enable/disable specification bit (w) shift register operation serial clock counter irqcsi flag so/sb0 and si/sb1 pins csie 1 shift operation enabled count operation can be set used in each mode as well as for port 0 signal from address comparator (r) coi note condition for being cleared (coi = 0) condition for being set (coi = 1) when the slave address register (sva) does not when the slave address register (sva) match the data of the shift register matches the data of the shift register note coi can be read only before serial transfer is started or after serial transfer is completed. an undefined value may be read during transfer. coi data written by an 8-bit manipulation instruction is ignored. wake-up function specification bit (w) wup 0 sets irqcsi each time serial transfer is completed. serial interface operation mode selection bit (w) csim4 csim3 csim2 shift register sequence p02/so/sb0 p03/si/sb1 pin function pin function x 0 0 sio 7-0 <> xa so si (transfer starting with msb) (cmos output) (cmos input) 1 sio 0-7 <> xa (transfer starting with lsb) remark x: dont care serial clock selection bit (w) csim1 csim0 serial clock sck pin mode 0 0 external clock applied to sck pin input 0 1 timer/event counter output (tout0) output 10f cc /2 4 (125 khz: during 2-mhz operation, 62.5 khz: during 1-mhz operation) 11f cc /2 3 (250 khz: during 2-mhz operation, 125 khz: during 1-mhz operation)
142 m pd750108 user's manual (b) serial bus interface control register (sbic) to use the three-wire serial i/o mode, set sbic as shown below. (for details on sbic format, see (2) in section 5.6.3 .) sbic is manipulated using a bit memory manipulation instruction. when the reset signal is input, sbic is set to 00h. in the figure below, hatched portions indicate the bits used in the three-wire serial i/o mode. remark (w): write only command trigger bit (w) cmdt control bit for command signal (cmd) trigger output. by setting cmdt = 1, the so latch is cleared. then the cmdt bit is automatically cleared to 0. bus release trigger bit (w) relt control bit for bus release signal (rel) trigger output. by setting relt = 1, the so latch is set to 1. then the relt bit automatically cleared to 0. caution never use bits other than relt and cmdt in the three-wire serial i/o mode. (2) communication operation the three-wire serial i/o mode transfers data, with eight bits as one block. data is transferred bit by bit in phase with the serial clock. the shift register performs shift operation on the falling edge of the serial clock (sck). send data is latched on the so latch, and is output on the so pin. receive data applied to the si pin is latched in the shift register on the rising edge of sck. when eight bits have been transferred, shift register operation automatically terminates setting the interrupt request flag (irqcsi). bsye ackd acke ackt cmdd reld cmdt relt fe2h sbic 76543210 address bus release trigger bit (w) command trigger bit (w) do not use these bits in the three-wire serial i/o mode.
143 chapter 5 peripheral hardware functions figure 5-44. timing of three-wire serial i/o mode the so pin becomes a cmos output and outputs the state of the so latch. so the output state of the so pin can be manipulated by setting the relt bit and cmdt bit. however, this manipulation must not be performed during serial transfer. the output level of the sck pin can be controlled by manipulating the p01 output latch in the output mode (internal system clock mode). (see section 5.6.8 .) (3) serial clock selection to select the serial clock, manipulate bits 0 and 1 of serial operation mode register 0 (csim). the serial clock can be selected out of the following four clocks: table 5-7. serial clock selection and application (in the three-wire serial i/o mode) mode register serial clock timing for shift register r/w and application csim csim source masking of start of serial transfer 1 0 serial clock 0 0 external automatically <1> in the operable mode slave cpu sck masked when (csie = 1) 0 1 tout 8-bit data <2> when the serial clock is half-duplex asyn- flip-flop transfer is masked after 8-bit transfer chronous transfer completed <3> when sck is high (software control) 10f cc /2 4 middle-speed serial transfer 11f cc /2 3 high-speed serial transfer sck si irqcsi 1 so 23 4 5 6 7 8 di0 do0 di1 do1 di2 do2 di3 do3 di4 do4 di5 do5 di6 do6 di7 do7 transfer operation is started in phase with falling edge of sck. execution of instruction that writes data to sio (transfer start request) completion of transfer when csie is set to 1, irqcsi is automatically cleared to 0. * *
144 m pd750108 user's manual (4) signals figure 5-45 shows operations of relt and cmdt. figure 5-45. operations of relt and cmdt (5) switching between msb and lsb as the first transfer bit the three-wire serial i/o mode has a function that can switch between the msb and lsb as the first bit of transfer. figure 5-46 shows the configuration of shift register (sio) and internal bus. as shown in figure 5-46, read or write operation can be performed by switching between the msb and lsb. this switching can be specified using bit 2 of serial operation mode register (csim). figure 5-46. transfer bit switching circuit the first bit is switched by changing the order of data bits written to shift register (sio). the shift operation order of sio is always the same. accordingly, the first bit must be switched between the msb and lsb before writing data to the shift register. so latch relt cmdt sck 7 6 internal bus 1 0 lsb first msb first si dq so read/write gate shift resister (sio) so latch read/write gate
145 chapter 5 peripheral hardware functions (6) transfer start serial transfer is started by writing transfer data into shift register (sio), provided that the following two conditions are satisfied: ? the serial interface operation enable/disable specification bit (csie) is set to 1. ? the internal serial clock is not operating after 8-bit serial transfer, or sck is high. caution setting csie to 1 after writing data to the shift register does not start transfer. when eight bits have been transferred, serial transfer automatically terminates setting the interrupt request flag (irqcsi). example to transfer the ram data specified with the hl register to sio, load the sio data to the accumulator and start serial transfer: mov xa,@hl ; fetch transmit data from ram sel mb15 ; or clr1 mbe xch xa,sio ; exchange transmit data and receive data, and start transfer (7) application of the three-wire serial i/o mode (a) data is transferred starting with the msb on a transfer clock of 62.5 khz (during 1-mhz operation). (master operation) clr1 mbe mov xa,#10000010b mov csim,xa ; set transfer mode mov xa,tdata ; tdata is transfer data storage address mov sio,xa ; set transfer data, and start transfer caution a second or subsequent transfer can be started by setting data in sio (mov sio,xa or xch xa,sio). in this case, the si/sbi pin on the m pd750108 can be used as an input. sck pd750108 so/sb0 sck si pd7225g (lcd controller/driver), etc.
146 m pd750108 user's manual (b) data is transmitted and received starting with the lsb on an external clock (slave operation). (in this case, the function of inverting the msb/lsb is used for shift register read/write operation.) main routine clr1 mbe mov xa,#84h mov csim,xa ; serial operation halt, msb/lsb invert mode, external clock mov xa,tdata mov sio,xa ; set transfer data, and start transfer ei iecsi ei interrupt routine (mbe = 0) mov xa,tdata xch xa,sio ; start to transfer receive data and transmit data mov rdata,xa ; save receive data reti (c) data is transmitted and received by using a transfer clock of 125 khz (during 1-mhz operation). p01/sck si/sb1 sck so other microcomputers so/sb0 si pd750108 sck pd750108 (master) so/sb0 sck si pd75206 , etc. si/sb1 so
147 chapter 5 peripheral hardware functions (master side): clr1 mbe mov xa,#10000011b mov csim,xa ; set transfer mode mov xa,tdata mov sio,xa ; set transfer data, and start transfer . . . . . . . . . . loop : sktclr irqcsi ; test irqcsi br loop mov xa,sio ; read in receive data 5.6.6 two-wire serial i/o mode the two-wire serial i/o mode can be made compatible with any communication format by programming. in this mode, communication is basically performed using two lines: serial clock (sck) and serial data input/ output (sb0 or sb1). figure 5-47. example of two-wire serial i/o system configuration remark the m pd750108 can also be used as a slave cpu. (1) register setting to set the two-wire serial i/o mode, manipulate the following two registers: ? serial operation mode register (csim) ? serial bus interface control register (sbic) sck master cpu (pd750108) sb0, sb1 slave cpu sck sb0, sb1 v dd 2-wire serial i/o 2-wire serial i/o
148 m pd750108 user's manual (a) serial operation mode register (csim) to use the two-wire serial i/o mode, set csim as shown below. (for details on csim format, see (1) in section 5.6.3 .) csim is manipulated using an 8-bit manipulation instruction. bits 7, 6, and 5 of csim can be manipulated bit by bit. when the reset signal is input, csim is set to 00h. in the figure below, hatched portions indicate the bits used in the two-wire serial i/o mode. remark (r): read only (w): write only serial interface operation enable/disable specification bit (w) shift register operation serial clock counter irqcsi flag so/sb0 and si/sb1 pins csie 1 shift operation enabled count operation can be set used in each mode as well as for port 0 signal from address comparator (r) coi note condition for being cleared (coi = 0) condition for being set (coi = 1) when the slave address register (sva) does not when the slave address register (sva) match the data of the shift register matches the data of the shift register note coi can be read only before serial transfer is started or after serial transfer is completed. an undefined value may be read during transfer. coi data written by an 8-bit manipulation instruction is ignored. wake-up function specification bit (w) wup 0 sets irqcsi each time serial transfer is completed. csie coi wup csim4 csim3 csim2 csim1 csim0 fe0h csim 76543210 address serial clock selection bit (w) serial interface operation mode selection bit (w) wake-up function specification bit (w) match signal from address comparator (r) serial interface operation enable/disable specification bit (w)
149 chapter 5 peripheral hardware functions serial interface operation mode selection bit (w) csim4 csim3 csim2 shift register sequence p02/so/sb0 p03/si/sb1 pin function pin function 0 1 1 sio 7-0 <> xa sb0 (n-ch open- p03 (cmos input) (transfer starting with msb) drain i/o) 1 p02 (cmos input) sb1 (n-ch open- drain i/o) serial clock selection bit (w) csim1 csim0 serial clock sck pin mode 0 0 external clock applied to sck pin input 0 1 timer/event counter output (tout0) output 10f cc /2 6 (31.3 khz: during 2-mhz operation, 1 1 15.6 khz : during 1-mhz operation) (b) serial bus interface control register (sbic) to use the two-wire serial i/o mode, set sbic as shown below. (for details on sbic format, see (2) in section 5.6.3 .) sbic is manipulated using a bit manipulation instruction. when the reset signal is input, sbic is set to 00h. in the figure below, the hatched portions indicate the bits used in the two-wire serial i/o mode. remark (w): write only command trigger bit (w) cmdt control bit for command signal (cmd) trigger output. by setting cmdt = 1, the so latch is cleared to 0. then the cmdt bit is automatically cleared to 0. bsye ackd acke ackt cmdd reld cmdt relt fe2h sbic 76543210 address bus release trigger bit (w) command trigger bit (w) do not use these bits in the two-wire serial i/o mode.
150 m pd750108 user's manual bus release trigger bit (w) relt control bit for bus release signal (rel) trigger output. by setting relt = 1, the so latch is set to 1. then the relt bit automatically cleared to 0. caution never use bits other than relt and cmdt in the two-wire serial i/o mode. (2) communication operation the two-wire serial i/o mode transfers data, with eight bits as one block. data is transferred bit by bit in phase with the serial clock. the shift register performs shift operation on the falling edge of the serial clock (sck). transmit data is latched on the so latch, and is output on the sb0/p02 pin or sb1/p03 pin starting with the msb. receive data applied to the sb0 pin or sb1 pin is latched in the shift register on the rising edge of sck. when eight bits have been transferred, shift register operation automatically terminates setting the interrupt request flag (irqcsi). figure 5-48. timing of two-wire serial i/o mode the sb0 (or sb1) pin becomes an n-ch open-drain i/o when specified as the serial data bus, so the voltage level on that pin must be pulled up externally. the state of the so latch is output on the sb0 (or sb1) pin, so the sb0 (or sb1) pin output states can be controlled by setting the relt or cmdt bit. however, this operation must not be performed during serial transfer. the output state of the sck pin can be controlled by manipulating the p01 output latch in the output mode (internal system clock mode). (see section 5.6.8 .) sck sb0, sb1 irqcsi 1 2345678 d0 d1 d2 d3 d4 d5 d6 d7 transfer operation is started in phase with falling edge of sck. execution of instruction that writes date to sio (transfer start request) completion of transfer
151 chapter 5 peripheral hardware functions (3) serial clock selection to select the serial clock, manipulate bits 0 and 1 of serial operation mode register (csim). the serial clock can be selected out of the following four clocks: table 5-8. serial clock selection and application (in the two-wire serial i/o mode) mode register serial clock timing for shift register r/w and application csim csim source masking of start of serial transfer 1 0 serial clock 0 0 external automatically <1> in the operable mode slave cpu sck masked when (csie = 1) 0 1 tout 8-bit data <2> when the serial clock is arbitrary-speed flip-flop transfer is masked after 8-bit transfer serial transfer completed <3> when sck is high 10f cc /2 6 low-speed 11 serial transfer (4) signals figure 5-49 shows operations of relt and cmdt. figure 5-49. operations of relt and cmdt (5) transfer start serial transfer starts by writing transfer data into shift register (sio), provided that the following two conditions are satisfied: ? the serial interface operation enable/disable specification bit (csie) is set to 1. ? the internal serial clock is not operating after 8-bit serial transfer, or sck is high. cautions 1. setting csie to 1 after writing data to the shift register does not start transfer. 2. when data is received, the n-ch transistor must be turned off, so ffh must be written to sio beforehand. when eight bits have been transferred, serial transfer automatically terminates setting the interrupt request flag (irqcsi). * so latch relt cmdt
152 m pd750108 user's manual (6) error detection in the two-wire serial i/o mode, the state of serial bus sb0 or sb1 being used for communication is loaded into the shift register (sio) of the transmitting device. so a transmission error can be detected by the methods described below. (a) comparing sio data before start of transmission with sio data after start of transmission with this method, the occurrence of a transmission error is assumed when two sio values disagree with each other. (b) using the slave address register (sva) transmit data is set in sva as well before the data is transmitted. on completion of transmission, the coi bit (match signal from the address comparator) of serial operation mode register (csim) is tested. if the result is 1, the transmission is regarded as successful. if the result is 0, the occurrence of a transmission error is assumed. (7) application of two-wire serial i/o mode a serial bus is configured, and multiple devices are connected to it. example a system is configured with a m pd750108 as the master to which a m pd75104, m pd75402a, and m pd7225g are connected as slaves. to configure the bus as shown above, connect the si pin and so pin. then, writes ffh to the shift register to make the so pin high except when serial data is output, and free the bus by setting off the output buffer. the so pin of the m pd75402a cannot go into a high-impedance state, so that a transistor must be connected as shown in the figure to make open collector output appear on the pin. when data is input, 00h must be set beforehand in the shift register to set the transistor off. the timing of data output by each microcontroller must be predetermined. port pd750108 (master) so/sb0 cs si pd7525g v dd sck sck sck so pd75402a si sck so pd75104 si
153 chapter 5 peripheral hardware functions the m pd750108, which is the master microcontroller, outputs a serial clock, and all slave microcontrollers operate with an external clock. 5.6.7 sbi mode operation the sbi (serial bus interface) is a high-speed serial interface that conforms to the nec serial bus format. to allow communication with multiple devices on a single-master and high-speed serial bus using two signal lines, the sbi has a bus configuration function added to the clock synchronous serial i/o method. so the sbi can reduce ports and wires on boards when multiple microcontrollers and peripheral ics are used to configure a serial bus. the master can output, on the serial data bus, an address for selecting a device subject to serial communication, commands directed to the remote device, and data. a slave can identify an address, commands, and data from received data by hardware. this function simplifies the serial interface control portion of an application program. the sbi function is available with devices such as the 75x series, 75xl series, and 78k series 8-/16-bit single chip microcontrollers. figure 5-50 is an example of the sbi system configuration when the cpu with a serial interface conforming to sbi or peripheral ics are used. figure 5-50. example of sbi system configuration v dd sck sb0, sb1 master cpu sck sb0, sb1 sck sb0, sb1 sck sb0, sb1 address 1 slave cpu address 2 slave cpu address n slave ic pd750108 pd750108
154 m pd750108 user's manual cautions 1. in the sbi mode, the serial data bus pin sb0 (or sb1) is an open-drain output. so the serial data bus line is placed in the wired or state. a pull-up resistor is required for the serial data bus line. 2. to switch between the master and slave, a pull-up resistor is required also for the serial clock line (sck) because sck input/output switching is performed between the master and slave asynchronously. (1) sbi functions conventional serial i/o methods provide only data transfer functions. therefore, many ports and wires are required to identify chip select signals, commands, and data, and to detect busy states, when the serial bus is configured with multiple devices. also, these processes are too burdensome to be controlled by software. the sbi method can configure a serial bus with two signal lines: serial clock sck and serial data bus (sb0 or sb1). for this reason, the number of ports on a microcontroller can be reduced and the wiring on a circuit board can be simplified. sbi functions are described below. (a) address/command/data identification function serial data is classified into three types: address, command, and data. (b) address-based chip select function the master selects a chip for a slave by address transfer. (c) wake-up function a slave can easily check address reception (for chip select identification) with the wake-up function. this function can be set or released by software. when the wake-up function is set, an interrupt (irqcsi) is generated when a match address is received. for this reason, in communication with multiple devices, a cpu other than a selected slave can operate independently of serial communication. (d) acknowledge signal (ack) control function the acknowledge signal, which is used to confirm the reception of serial data, can be controlled. (e) busy signal (busy) control function the busy signal, which is used to post the busy state of a slave, can be controlled.
155 chapter 5 peripheral hardware functions (2) sbi definition the format of serial data and signal used in the sbi mode are described below. serial data to be transferred in the sbi mode is classified into three types: address, command, and data. serial data forms one frame as shown below. figure 5-51 is a timing chart for transferring address, command, and data. figure 5-51. timing of sbi transfer the bus release signal and command signal are output by the master. busy is output by a slave. ack is output by either the master or a slave. (normally, the device which received 8-bit data outputs ack.) the master continues to output the serial clock from when 8-bit data transfer starts to when busy is released. sck a7 sb0, sb1 busy 89 a0 ack c7 sb0, sb1 ready 9 c0 ack busy sb0, sb1 89 d7 ready d0 ack busy address transfer bus release signal command transfer command signal data transfer sck sck
156 m pd750108 user's manual (a) bus release signal (rel) when the sck line is high (the serial clock is not output), the sb0 (or sb1) line changes from low to high. this signal is called the bus release signal, and is output by the master. figure 5-52. bus release signal this signal indicates that the master is to send an address to a slave. slaves contain hardware to detect the bus release signal. (b) command signal (cmd) when the sck line is high (the serial clock is not output), the sb0 (or sb1) line changes from high to low. this signal is called the command signal, which is output by the master. figure 5-53. command signal slaves contain hardware to detect the command signal. (c) address an address is 8-bit data and is output by the master to connected slaves to select a particular slave. figure 5-54. address the 8-bit data following the bus release signal or command signal is defined as an address. a slave detects the condition for the addresses by hardware, and checks whether the 8-bit data matches the number assigned to the slave (slave address). if the 8-bit data matches the slave address, that slave is selected. the selected slave continues to communicate with the master until disconnection is directed by the master. sb0, sb1 12345678 address a7 a6 a5 a4 a3 a2 a1 a0 command signal bus release signal sck sb0, sb1 "h" sck sb0, sb1 "h" sck
157 chapter 5 peripheral hardware functions figure 5-55. slave selection using an address (d) command and data the master sends commands to the slave selected by sending an address. the master also transfers data to or from the slave. figure 5-56. command figure 5-57. data the 8-bit data following the command signal is defined as a command. the 8-bit data without the command signal is defined as data. the usage of commands or data can be selected optionally according to the communication specifications. (e) acknowledge signal (ack) the acknowledge signal confirms the reception of serial data between the transmitter and the receiver. sck sb0, sb1 12345678 command c7 c6 c5 c4 c3 c2 c1 c0 command signal sck sb0, sb1 12345678 data d7 d6 d5 d4 d3 d2 d1 d0 master transmits address for slave 2 slave 1 not selected slave 2 selected slave 3 not selected slave 4 not selected
158 m pd750108 user's manual figure 5-58. acknowledge signal [when output in phase with the 11th clock of sck] [when output in phase with the 9th clock of sck] the acknowledge signal is a one-shot pulse output in phase with the falling edge of sck after 8-bit data transfer. this signal may be synchronized with any clock of sck. the transmitter checks if the receiver returns the acknowledge signal after 8-bit data transfer. if the acknowledge signal is not returned after a specified period of time, the transmitter can assume that the reception failed. sck sb0, sb1 8 9 10 11 ack sb0, sb1 89 ack sck
159 chapter 5 peripheral hardware functions (f) busy signal (busy) and ready signal (ready) the busy signal informs the master that a slave is getting ready for data transfer. the ready signal informs the master that a slave is ready for data transfer. figure 5-59. busy and ready signals in the sbi mode, a slave notifies the master of the busy state by changing sb0 (or sb1) from high to low. the busy signal is output following the acknowledge signal output by the master or a slave. the busy signal is set and released in phase with the falling edge of sck. the master automatically terminates output of serial clock sck when the busy signal is released. the master can transfer the next data when the busy signal is released and a slave enters the state in which the ready signal is to be output. (3) register setting to set the sbi mode, manipulate the following two registers: ? serial operation mode register (csim) ? serial bus interface control register (sbic) (a) serial operation mode register (csim) to use the sbi mode, set csim as shown below. (for details on csim format, see (1) in section 5.6.3 .) csim is manipulated using an 8-bit manipulation instruction. bits 7, 6, and 5 of csim can be manipulated bit by bit. when the reset signal is input, csim is set to 00h. in the figure below, hatched portions indicate the bits used in the sbi mode. remark (r): read only (w): write only sb0, sb1 89 ack busy ready sck csie coi wup csim4 csim3 csim2 csim1 csim0 fe0h csim 76543210 address serial clock selection bit (w) serial interface operation mode selection bit (w) wake-up function specification bit (w) match signal from address comparator (r) serial interface operation enable/disable specification bit (w)
160 m pd750108 user's manual serial interface operation enable/disable specification bit (w) shift register operation serial clock counter irqcsi flag so/sb0 and si/sb1 pins csie 1 shift operation enabled count operation can be set used in each mode as well as for port 0 signal from address comparator (r) coi note condition for being cleared (coi = 0) condition for being set (coi = 1) when the slave address register (sva) does not when the slave address register (sva) match the data of the shift register matches the data of the shift register note coi can be read only before serial transfer is started or after serial transfer is completed. an undefined value may be read during transfer. coi data written by an 8-bit manipulation instruction is ignored. wake-up function specification bit (w) wup 0 sets irqcsi each time serial transfer is completed in each mode. 1 used in the sbi mode only to set irqcsi only when an address received after bus release matches the data in the slave address register (wake-up state). sb0 or sb1 goes to high- impedance state. caution when wup = 1 is set during busy signal output, busy is not released. in the sbi mode, the busy signal is output until the next falling edge of the serial clock (sck) appears after release of busy is directed. before setting wup = 1, be sure to confirm that the sb0 (or sb1) pin is high after releasing busy. serial interface operation mode selection bit (w) csim4 csim3 csim2 shift register sequence p02/so/sb0 p03/si/sb1 pin function pin function 0 1 0 sio 7-0 <> xa sb0 (n-ch open- p03 (cmos input) (transfer starting with msb) drain i/o) 1 p02 (cmos input) sb1 (n-ch open- drain i/o)
161 chapter 5 peripheral hardware functions serial clock selection bit (w) csim1 csim0 serial clock sck pin mode 0 0 external clock applied to sck pin input 0 1 timer/event counter output (tout0) output 10f cc /2 4 (125 khz: during 2-mhz operation, 62.5 khz: during 1-mhz operation) 11f cc /2 3 (250 khz: during 2-mhz operation, 125 khz: during 1-mhz operation) (b) serial bus interface control register (sbic) to use the sbi mode, set sbic as shown below. (for details on sbic format, see (2) in section 5.6.3 .) sbic is manipulated using a bit manipulation instruction. when the reset signal is input, sbic is set to 00h. in the figure below, hatched portions indicate the bits used in the sbi mode. remark (r): read only (w): write only (r/w): read/write busy enable bit (r/w) bsye 0 <1> the busy signal is automatically disabled. <2> busy signal output is stopped in phase with the falling edge of sck immediately after clear instruction execution. 1 the busy signal is output after the acknowledge signal in phase with the falling edge of sck. bsye ackd acke ackt cmdd cmdt reld relt 76543 1 20 address sbic bus release trigger bit (w) fe2h command trigger bit (w) bus release detection flag (r) command detection flag (r) acknowledge trigger bit (w) acknowledge enable bit (r/ w) acknowledge detection flag (r) busy enable bit (r/ w)
162 m pd750108 user's manual acknowledge detection flag (r) ackd condition for being cleared (ackd = 0) condition for being set (ackd = 1) <1> the transfer operation is started. the acknowledge signal (ack) is detected <2> the reset signal is entered. (in phase with the rising edge of sck). acknowledge enable bit (r/w) acke 0 disables automatic output of the acknowledge signal. (output by ackt is possible.) 1 when set before transfer ack is output in phase with the 9th clock of sck. when set after transfer ack is output in phase with sck immediately following the set instruction execution. acknowledge trigger bit (w) ackt when set after transfer, ack is output in phase with the next sck. after ack signal output, this bit is automatically cleared to 0. cautions 1. never set ackt to 1 before or during serial transfer. 2. ackt cannot be cleared by software. 3. before setting ackt, set acke = 0. command detection flag (r) cmdd condition for being cleared (cmdd = 0) condition for being set (cmdd = 1) <1> the transfer start instruction is executed. the command signal (cmd) is detected. <2> the bus release signal (rel) <3> the reset signal is entered. <4> csie = 0 ( figure 5-40 ) bus release detection flag (r) reld condition for being cleared (reld = 0) condition for being set (reld = 1) <1> the transfer start instruction is executed. the bus release signal (rel) is detected. <2> the reset signal is entered. <3> csie = 0 ( figure 5-40 ) <4> sva does not match sio when an address is received. command trigger bit (w) cmdt control bit for command signal (cmd) trigger output. by setting cmdt = 1, the so latch is cleared to 0. then the cmdt bit is automatically cleared to 0. caution never set sb0 (or sb1) during serial transfer. be sure to set sb0 (or sb1) before or after serial transfer.
163 chapter 5 peripheral hardware functions bus release trigger bit (w) relt control bit for bus release signal (rel) trigger output. by setting relt = 1, the so latch is set to 1. then the relt bit automatically cleared to 0. caution never set sb0 (or sb1) during serial transfer. be sure to set sb0 (or sb1) before or after serial transfer. (4) serial clock selection to select the serial clock, manipulate bits 0 and 1 of serial operation mode register (csim). the serial clock can be selected out of the following four clocks: table 5-9. serial clock selection and application (in the sbi mode) mode register serial clock timing for shift register r/w and application csim csim source masking of start of serial transfer 1 0 serial clock 0 0 external automatically <1> in the operable mode slave cpu sck masked when (csie = 1) 0 1 tout 8-bit data <2> when the serial clock is arbitrary-speed flip-flop transfer is masked after 8-bit transfer serial transfer completed <3> when sck is high 1 0f cc /2 4 middle-speed serial transfer 11f cc /2 3 high-speed serial transfer when the internal system clock is selected, sck is internally terminated when the 8th clock has been output, and is externally counted until the slave enters the ready state. (5) signals figures 5-60 to 5-65 show signals to be generated in the sbi mode and flag operations on the sbic. table 5-10 lists signals used in the sbi mode. *
164 m pd750108 user's manual figure 5-60. operations of relt, cmdt, reld, and cmdd (master) figure 5-61. operations of relt, cmdt, reld, and cmdd (slave) sio sck so latch relt cmdt reld cmdd transfer start request "h" sio sck 12 78 d7 d6 d1 d0 so latch relt (master) cmdt (master) reld cmdd transfer start request write to sio. when address match is found when address mismatch is found
165 chapter 5 peripheral hardware functions figure 5-62. operation of ackt caution do not set the ackt until the transfer is completed. figure 5-63. operation of acke (1/2) (a) when acke = 1 at time of transfer completion (b) when acke is set after transfer completion (c) when acke = 0 at time of transfer completion sck 6789 d2 d1 d0 sb0, sb1 ack ackt ack signal is output during the first clock cycle immediately after ackt is set. when set during this period when ackt is set after transfer completion sck 12 78 d7 d6 d2 d1 sb0, sb1 d0 9 ack acke when acke = 1 at this point the ack signal is output during the ninth clock cycle. sck 6789 d2 d1 d0 sb0, sb1 ack acke the ack signal is output during the first clock cycle immediately after acke is set. when acke is set during this period and acke = 1 at the falling edge of the next sck sck 12 78 d7 d6 d2 d1 sb0, sb1 d0 9 acke the ack signal is not output. when acke = 0 at this point
166 m pd750108 user's manual figure 5-63. operation of acke (2/2) (d) when acke = 1 period is too short figure 5-64. operation of ackd (1/2) (a) when ack signal is output during the ninth sck clock (b) when ack signal is output after the ninth sck clock sck sb0, sb1 acke the ack signal is not output. when acke is set or cleared during this period and acke = 0 at the falling edge of sck sio sck 9 8 d2 d1 d0 sb0, sb1 ackd 7 6 ack transfer start request transfer start sio sck d2 d1 d0 sb0, sb1 ackd 9 ack 8 7 6 transfer start request transfer start
167 chapter 5 peripheral hardware functions figure 5-64. operation of ackd (2/2) (c) clear timing for case where start of transfer is directed during busy figure 5-65. operation of bsye sio sck d2 d1 d0 sb0, sb1 ackd 9 busy 8 7 6 d7 ack transfer start request d6 transfer start sck sb0, sb1 bsye 9 busy 8 7 6 ack when bsye = 1 at this point when reset operation is executed during this period and bsye = 0 at the falling edge of sck
168 m pd750108 user's manual table 5-10. various signals used in the sbi mode (1/2) sck sb0, sb1 h h sck sb0, sb1 high level signal output on sb0 or sb1 before serial transfer is started or after serial transfer is completed output device definition execution of instruction to write data to sio (transfer start request) condition for output flag operation meaning of signal indicates that serial reception is enabled. signal name timing chart ready ready ack sck d0 d0 sb0, sb1 9 busy ack busy - - [synchronous busy output] sb0, sb1 relt is set. cmdt is set. <1> acke = 1 <2> ackt is set. bsye = 1 <2> <1> bsye = 0 reld is set. cmdd is cleared. ackd is set. cmdd is set. indicates that cmd signal follows and data transmitted is address data. data transmitted after rel signal output is address. data transmitted, with rel signal not being output, is command. i) ii) indicates completion of reception. indicates that serial reception is disabled because processing is in progress. bus release signal (rel) command signal (cmd) acknowledge signal (ack) busy signal (busy) ready signal (ready) master master master/ slave slave slave rising edge of sb0 or sb1 when sck = 1 falling edge of sb0 or sb1 when sck = 1 low level signal output on sb0 or sb1 during one sck clock cycle after serial reception is completed [synchronous busy signal] low level signal output on sb0 or sb1 after acknowledge signal ? ? ? ? ? ? ?
169 chapter 5 peripheral hardware functions table 5-10. various signals used in the sbi mode (2/2) notes 1. when wup = 0, irqcsi is always set on the ninth rising edge of the sck signal. when wup = 1, irqcsi is set on the ninth rising edge of sck only when the received address matches the value held in the slave address register (sva). 2. in the busy state, data transfer is initiated after the ready state is set. synchronous clock for outputting address/ command/data, ack signal, synchronous busy signal, and so on. address/command/data is output during first 8 clock cycles. output device definition execution of instruction to write data to sio when csie = 1 (serial transfer start request) note 2 condition for output irqcsi is set (on rising edge of 9th clock of sck) note 1 flag operation meaning of signal signal name timing chart sck sb0, sb1 12 78910 sck sb0, sb1 12 78 sck sb0, sb1 12 78 cmd rel cmd sck sb0, sb1 12 78 timing of signal output on serial data bus address of slave device on serial bus directions and messages to slave device numeric processed by slave or master device serial clock (sck) address (a7 - a0) command (c7 - c0) data (d7 - d0) 8-bit data transferred in phase with sck after rel signal and cmd signal output 8-bit data transferred in phase with sck after only cmd signal is output, with rel signal not being output 8-bit data transferred in phase with sck, with neither rel signal nor cmd signal being output master master master master/ slave
170 m pd750108 user's manual (6) pin configuration the configurations of serial clock pin sck and serial data bus pin (sb0 or sb1) are as follows: (a) sck: pin for serial clock i/o <1> master : cmos, push-pull output <2> slave : schmitt input (b) sb0, sb1: pin for serial data i/o output to sb0 or sb1 is an n-ch open-drain output and input is schmitt input for both the master and a slave. the serial data bus line must be externally pulled up because it has originally an n-ch open-drain output. figure 5-66. pin configuration caution when data is received, the n-ch transistor must be turned off, so ffh must be written to sio beforehand. the n-ch open-drain output can be turned off at any time during transfer. however, when the wake-up function specification bit (wup) is set to 1, the n-ch transistor is always off, so there is no need to write ffh to sio before reception. so r l si so si sb0, sb1 sb0, sb1 serial data bus n-ch open-drain n-ch open-drain (clock input) clock output clock input (clock output) serial clock master device slave device
171 chapter 5 peripheral hardware functions (7) address match detection method in the sbi mode, communication starts when the master selects a particular slave device by outputting an address. an address match is detected by hardware. the slave address register (sva) is available. in the wake- up state (wup = 1), irqcsi is set only when the address transmitted by the master and the value held in sva match. cautions 1. whether a slave is selected is determined by detecting a match for a slave ad- dress received after bus release (in the state of reld = 1). an address match is detected usually using an address match interrupt (irqcsi) generated when wup is set to 1. so detect selection/nonselection state by slave address when wup is set to 1. 2. when determining whether a slave is selected without using an interrupt when wup is 0, do not use the address match detection method. instead, use transfer of commands set in advance in a program. (8) error detection in the sbi mode, the state of serial bus sb0 (or sb1) being used for communication is loaded into the shift register (sio) of the transmitting device. so a transmission error can be detected by the methods described below. (a) comparing sio data before start of transmission with sio data after start of transmission with this method, the occurrence of a transmission error is assumed if two sio values disagree with each other. (b) using the slave address register (sva) transmit data is set in sio and sva as well before the data is transmitted. on completion of transmission, the coi bit (match signal from the address comparator) of serial operation mode register (csim) is tested. if the result is 1, the transmission is regarded as successful. if the result is 0, the occurrence of a transmission error is assumed. (9) communication operation in the sbi mode, the master usually selects a slave device to communicate with from multiple devices by outputting the address of the slave to the serial bus. after selecting a device to communicate with, the master exchanges commands and data with the slave device, thus establishing serial communication. figures 5-67 to 5-70 show the timing charts of data communication operations. in the sbi mode, the shift register performs shift operation on the falling edge of the serial clock (sck). transmit data is held on the so latch, and is output on the sb0/p02 or sb1/p03 pin starting with the msb. receive data applied to the sb0 (or sb1) pin is latched in the shift register on the rising edge of sck.
172 m pd750108 user's manual figure 5-67. address transfer operation from master device to slave device (wup = 1) program processing hardware operation program processing sck pin 123456789 sb0 or sb1 pin a7 hardware operation a6 a5 a4 a3 a2 a1 a0 ack ready address master device processing (transmitter) transfer line slave device processing (receiver) interrupt handling (preparation for next serial transfer) set ackd serial transmission generate irqcsi clear busy serial reception output busy clear busy busy set cmdt set relt set cmdt write to sio stop sck wup<-0 set ackt set cmdd clear cmdd set reld set cmdd generate irqcsi (when sva = sio) output ack
173 chapter 5 peripheral hardware functions figure 5-68. command transfer operation from master device to slave device program processing hardware operation program processing sck pin 123456789 sb0 or sb1 pin c7 hardware operation c6 c5 c4 c3 c2 c1 c0 ack ready command master device processing (transmitter) transfer line slave device processing (receiver) interrupt handling (preparation for next serial transfer) serial transmission generate irqcsi serial reception generate irqcsi output busy clear busy busy set cmdt write to sio set ackd stop sck read sio analyze command set ackt clear busy set cmdd output ack
174 m pd750108 user's manual figure 5-69. data transfer operation from master device to slave device program processing hardware operation program processing sck pin 123456789 sb0 or sb1 pin d7 hardware operation d6 d5 d4 d3 d2 d1 d0 ack ready data master device processing (transmitter) transfer line slave device processing (receiver) interrupt handling (preparation for next serial transfer) serial transmission generate irqcsi serial reception generate irqcsi busy write to sio set ackd stop sck read sio set ackt clear busy output busy output ack clear busy
175 chapter 5 peripheral hardware functions figure 5-70. data transfer operation from slave device to master device program processing hardware operation program processing sck pin 123456789 12 sb0 or sb1 pin busy ready d7 hardware operation d6 d5 d4 d3 d2 d1 d0 ack busy d7 d6 ready data master device processing (receiver) transfer line slave device processing (transmitter) write ffh to sio read sio set ackt receive data processing stop sck serial reception generate irqcsi output ack serial reception write to sio write to sio clear busy serial transmission generate irqcsi set ackd output busy clear busy write ffh to sio
176 m pd750108 user's manual (10) transfer start serial transfer is started by writing transfer data in shift register (sio), provided that the following two conditions are satisfied: ? the serial interface operation enable/disable bit (csie) is set to 1. ? the internal serial clock is not operating after 8-bit serial transfer, or sck is high. cautions 1. transfer cannot be started by setting csie to 1 after writing data to the shift register. 2. the n-ch transistor needs to be turned off when data is received. so ffh must be written to sio beforehand. however, when the wake-up function specification bit (wup) is set to 1, the n-ch transistor is always off. so ffh need not be written to sio beforehand for reception. 3. if data is written to sio when the slave is busy, the data is not lost. transfer is started when the busy state is released and input to sb0 (or sb1) goes high. when eight bits have been transferred, serial transfer automatically terminates setting the interrupt request flag (irqcsi). example when ram data specified by the hl register is transferred to sio, from which data is loaded into the accumulator at the same time, and serial transfer is started. mov xa,@hl ; extracts transmit data from ram sel mb15 ; or clr1 mbe xch xa,sio ; exchanges transmit data with receive data and starts transfer (11) notes on the sbi mode (a) whether a slave is selected is determined by detecting a match for a slave address received after bus release (in the state of reld = 1). an address match is detected usually using, an address match interrupt (irqcsi) generated when wup is 1. so detect selection/nonselection state by slave address when wup is set to 1. (b) when determining whether a slave is selected without using an interrupt when wup = 0, do not use the address match detection method. instead, use transfer of commands set in advance in a program. (c) when wup is set to 1 during busy signal output, busy is not released. in the sbi mode, after release of busy is directed, the busy signal is output until the next falling edge of the serial clock (sck) appears. before setting wup to 1, be sure to confirm that the sb0 (or sb1) pin is high after releasing busy.
177 chapter 5 peripheral hardware functions (12) sbi mode this section describes an example of application which performs serial data communication in the sbi mode. in the example, the m pd750108 can be used as either the master cpu or a slave cpu on the serial bus. the master can be switched to another cpu with a command. (a) serial bus configuration in the serial bus configuration used for the example of this section, a m pd750108 is connected to the bus line as a device on the serial bus. two pins on the m pd750108 are used: serial data bus sb0 (or sb1) and serial clock sck (p01). figure 5-71 shows an example of the serial bus configuration. figure 5-71. example of serial bus configuration sck sb0, sb1 sck sb0, sb1 sb0, sb1 sb0, sb1 address 1 address 2 slave cpu address n slave ic v dd sck sck master cpu slave cpu pd750108 pd750108
178 m pd750108 user's manual (b) explanation of commands (i) types of commands this example uses the following commands: <1> read command : transfers data from slave to master. <2> write command : transfers data from master to slave. <3> end command : informs slave of write command completion. <4> stop command : informs slave of write command interruption. <5> status command : reads slave status. <6> reset command : sets currently selected slave as non-selected slave. <7> chgmst command: passes master authority to slave. (ii) protocol the following protocol is used for communication between the master and slaves. <1> the address of a slave with which the master intends to communicate is transmitted to select the slave (chip select). this starts communication. the slave that has received the address returns ack to engage in communication with the master (the state of the slave is changed from the non-selected state to selected state). <2> commands and data are transferred between the master and the slave selected in <1> . command and data are transferred between the master and the selected slave on a one- to-one basis, so the other slaves must be placed in the non-selected state. <3> communication is completed when the selected slave is placed in the non-selected state. this state is caused in the following cases: ? the selected slave is placed in the non-selected state when the slave receives a reset command from the master. ? the device that is switched from the master to a slave with a chgmst command is placed in the non-selected state. (iii) command format the transfer format of each command is described below. <1> read command the read command reads data from a slave. one to 256 bytes of data can be read. the data length is specified in a parameter by the master. when 00h is specified as the data length, the 256-byte data transfer is assumed. figure 5-72. transfer format of the read command remark m: output by the master s: output by the slave read m ack s data count m data ack s data 0 s data ack s data n s data ack s command
179 chapter 5 peripheral hardware functions when the slave receives a transmission data count, if it has data enough for transmitting the specified number of bytes of data, the slave returns ack. if the slave does not have enough data for transmission, an error occurs; ack is not returned in this case. the master sends ack to the slave each time it receives one byte. <2> write command, end command, stop command these commands write data to a slave. one to 256 bytes of data can be written. the data length is specified in a parameter by the master. when 00h is specified as the data length, the 256-byte data transfer is assumed. figure 5-73. transfer format of the write and end commands remark m: output by the master s: output by the slave if the slave has an enough area for storing receive data of the specified length, the slave returns ack. if the slave does not have an enough area, an error occurs; ack is not returned in this case. the master transmits an end command when all data have been transferred. the end command informs the slave that all data have been transferred correctly. the slave accepts an end command even before data reception is uncompleted. in this case, the data received just before the acceptance of the end command becomes valid. the master compares the contents of sio before transfer with the contents of sio after transfer to check whether the data has been output onto the bus correctly. if the contents of sio disagree with each other, the master interrupts data transfer by transmitting a stop command. figure 5-74. transfer format of the stop command remark m: output by the master s: output by the slave when the slave receives a stop command, the slave invalidates the most recently received one byte. write m ack s data count m data ack s data 0 m data ack s data n m data ack s end m command ack s command data m ack s data stop m ack s command data check error occurs. data transfer interruption
180 m pd750108 user's manual <3> status command the status command reads the status of the current slave. figure 5-75. transfer format of the status command remark m: output by the master s: output by the slave the slave returns the status in the format shown in figure 5-78 . figure 5-76. status format of the status command when the master receives a status, it returns ack to the current slave. status m ack s data status s ack s command 76543210 status msb lsb all 0s bit indicating whether there is data ready for transmission 0 : no transmit data 1 : transmit data of one byte or more bit indicating whether the device is ready for data reception 0 : no receive data storage area 1 : receive data storage area not smaller than one byte is present. bit indicating whether an error occurred 0 : no error 1 : error occurred during previous transfer. bit indicating whether master can be changed or not 0 : master cannot be changed. 1 : master can be changed.
181 chapter 5 peripheral hardware functions <4> reset command the reset command changes the currently selected slave to a non-selected slave. when a reset command is transmitted, any slave can be placed in the non-selected state. figure 5-77. transfer format of the reset command remark m: output by the master s: output by the slave <5> chgmst command the chgmst command passes the master authority to the currently selected slave. figure 5-78. transfer format of the chgmst command remark m: output by the master s: output by the slave when the slave receives a chgmst command, the slave returns one of the following data to the master after checking whether the slave can receive the master authority: ? 0ffh: master changeable ? 00h: master not changeable the slave compares the contents of sio before transfer with the contents of sio after transfer. if the contents of sio disagree with each other, an error occurs; ack is not returned in this case. if the master receives 0ffh, the master returns ack to the slave, and starts to operate as a slave. the slave which transmitted 0ffh starts to operate as the master when it receives ack. (iv) error occurrence if a communication error occurs, the operation described below is performed. the slave reports the occurrence of an error by not returning ack to the master. if an error occurs during reception of data, the slave sets the status bit for indicating error occurrence, and cancels all command processing being performed. when the transmission of one byte is completed, the master checks for ack from the slave. reset m ack s command chgmst m ack s command data s ack s data
182 m pd750108 user's manual if ack is not returned from the slave within a predetermined period after transmission completion, the occurrence of an error is assumed; the master outputs the ack signal as a dummy. figure 5-79. master and slave operation in case of error the following errors may occur: ? error that may occur on the slave side <1> invalid command transfer format <2> reception of an undefined command <3> insufficient number of transfer data bytes for a read command <4> insufficient area to contain data for a write command <5> change in data during transmission of a read, status, or chgmst command if any of the above types of errors occurs, ack is not returned. ? error that may occur on the master side if data transmitted with a write command changes during transmission, the master transmits a stop command to the slave. 5.6.8 manipulation of sck pin output the sck/p01 pin has a built-in output latch, so that this pin allows static output by software manipulation in addition to normal serial clock output. the number of sck pulses can be software-set arbitrarily by manipulating the p01 output latch. (the so/ sb0/p02 or si/sb1/p03 pin is controlled by manipulating the relt and cmdt bits of sbic.) the procedure for manipulating sck/p01 pin output is explained below. <1> set serial operation mode register (csim) (sck pin: output mode). when serial transfer is halted, sck from the serial clock control circuit is set to 1. <2> manipulate the p01 output latch by using a bit manipulation instruction. reception is completed. error is assumed, and processing is halted. transfer is completed. ack check is started. ack wait time ack from slave is checked. error is assumed. ack is output. erroneous data ack processing by slave sb0, sb1 processing by master
183 chapter 5 peripheral hardware functions example to output one sck/p01 pin clock cycle by software sel mb15 ; or clr1 mbe mov xa,#10000011b ; sck (f cc /2 3 ), output mode mov csim,xa clr1 0ff0h.1 ; sck/p01 <- 0 set1 0ff0h.1 ; sck/p01 <- 1 figure 5-80. sck/p01 pin circuit configuration the p01 output latch is mapped to bit 1 of address ff0h. a reset signal sets the p01 output latch to 1. cautions 1. during normal serial transfer, the p01 output latch must be set to 1. 2. the p01 output latch cannot be addressed by specifying port0.1 (as described below). the address of the latch (0ff0h.1) must be coded in the operand of an instruction directly. or, the address must be specified with sckp. however, mbe = 0 (or mbe = 1, mbs = 15) must be specified before the instruction is executed. not allowed allowed clr1 port0.1 clr1 0ff0h.1 set1 port0.1 set1 0ff0h.1 clr1 sckp set1 sckp p01/sck p01 output latch sck to internal circuit address ff0h.1 sck pin output mode from the serial clock control circuit *
184 m pd750108 user's manual 5.7 bit sequential buffer: 16-bit the bit sequential buffer (bsb) is special data memory for bit manipulations. in particular, the buffer allows bit manipulations to be performed very easily by sequentially changing address and bit specifications. so the buffer is useful in processing long data bit by bit. this data memory consists of 16 bits, and allows pmem.@l addressing with a bit manipulation instruction. this addressing uses the l register for indirect bit specification. in this case, only by incrementing or decrementing the l register in a program loop, the bit to be manipulated can be sequentially shifted for continued processing. figure 5-81. format of the bit sequential buffer remarks 1. with pmem.@l addressing, bit specification is shifted according to the l register. 2. with pmem.@l addressing, bsb can be manipulated at any time regardless of mbe/mbs specification. data can also be manipulated by direct addressing. the buffer can be used for applications such as continuous 1-bit data input or output operations by combining direct 1-bit, 4-bit, and 8-bit addressing with pmem.@l addressing. in 8-bit manipulation, the higher eight bits or lower eight bits are manipulated by specifying bsb0 or bsb2. 3210321032103210 bsb3 bsb2 bsb1 bsb0 fc3h fc2h fc1h fc0h l = fh l = ch l = bh l = 8h l = 7h l = 4h l = 3h l = 0h decs l incs l address bit l register symbol
185 chapter 5 peripheral hardware functions example to output 16-bit data of buff1 and buff2 serially from bit 0 of port 3: clr1 mbe mov xa,buff1 mov bsb0,xa ; set bsb0 and bsb1 mov xa,buff2 mov bsb2,xa ; set bsb2 and bsb3 mov l,#0 loop0: skt bsb0, @l ; tests the specification bit of bsb br loop1 nop ; dummy (for timing adjustment) set1 port3. 0 ; sets bit 0 of port 3 br loop2 loop1: clr1 port3. 0 ; clears bit 0 of port 3 nop ; dummy (for timing adjustment) nop loop2: incs l ; l <- l + 1 br loop0 ret
186 m pd750108 user's manual [memo]
187 chapter 6 interrupt and test functions chapter 6 interrupt and test functions the m pd750108 has seven vectored interrupt sources and two test inputs, allowing a wide range of applications. in addition, the interrupt control circuitry of the m pd750108 has the following features for very high-speed interrupt processing. (1) interrupt functions (a) hardware controlled vectored interrupt function which can control whether or not to accept an interrupt using the interrupt flag (iexxx) and interrupt master enable flag (ime). (b) the interrupt start address can be set arbitrarily. (c) multiple interrupt function which can specify the priority by the interrupt priority specification register (ips) (d) test function of an interrupt request flag (irqxxx) (the software can confirm that an interrupt occurred.) (e) release of the standby mode (interrupts released by an interrupt enable flag can be selected.) (2) test functions (a) whether test request flags (irqxxx) are issued can be checked with software. (b) release of the standby mode (a test source to be released can be selected with test enable flags.) 6.1 configuration of the interrupt control circuit figure 6-1 shows the configuration of the interrupt control circuit. each hardware item is mapped to a data memory space. 6
188 m pd750108 user's manual figure 6-1. block diagram of interrupt control circuit 2 im2 14 irqbt irq4 irq0 irq1 irqcsi irqt0 irqt1 irqw irq2 intbt int4/p00 int0/p10 int1/p11 intcsi intt0 intt1 intw int2/p12 both-edge detection circuit im0 edge detection circuit edge detection circuit rising edge detection circuit falling edge detection circuit kr0/p60 kr7/p73 selec- tor im2 interrupt enable flag (iexxx) ips ist0 ime priority control circuit decoder vrqn vector table address generator standby release signal internal bus selec- tor note im1 note noise eliminator (when the noise eliminator is selected, standby mode cannot be released.) ist1
189 chapter 6 interrupt and test functions 6.2 types of interrupt sources and vector tables table 6-1 lists the types of interrupt sources, and figure 6-2 shows vector tables. table 6-1. interrupt sources interrupt source signal in/out interrupt vectored interrupt request priority note (vector table address) intbt reference time interval signal from in 1 vrq1 (0002h) basic interval timer/wactchdog timer int4 detection of both rising and falling out edges int0 rising/falling edge out 2 vrq2 (0004h) int1 detection specification out 3 vrq3 (0006h) intcsi serial data transfer completion signal in 4 vrq4 (0008h) intt0 match signal between the count in 5 vrq5 (000ah) register of timer/event counter 0 and modulo register intt1 match signal between the count in 6 vrq6 (000ch) register of timer counter 1 and modulo register note the interrupt priority is used to determine the priority when two or more interrupts are simultaneously generated. figure 6-2. interrupt vector table mbe rbe intbt/int4 start address 0002h intbt/int4 start address mbe rbe int0 start address 0004h int0 start address mbe rbe int1 start address 0006h int1 start address mbe rbe intcsi start address 0008h intcsi start address mbe rbe int t0 start address 000ah int t0 start address mbe rbe int t1 start address 000ch int t1 start address address 0000h mbe rbe internal reset start address internal reset start address (high-order 6 bits) (low-order 8 bits) (high-order 6 bits) (low-order 8 bits) (high-order 6 bits) (low-order 8 bits) (high-order 6 bits) (low-order 8 bits) (high-order 6 bits) (low-order 8 bits) (high-order 6 bits) (low-order 8 bits) (high-order 6 bits) (low-order 8 bits)
190 m pd750108 user's manual the column of interrupt priority in table 6-1 indicates a priority assigned when multiple interrupt requests occur concurrently or are held. a vector table contains interrupt processing start addresses and mbe and rbe setting values during interrupt processing. an assembler pseudo instruction (ventn: n = 1 to 6) is used to set a vector table. example a vector table is set for intbt/int4. vent1 mbe = 0, rbe = 0, gotobt 191 chapter 6 interrupt and test functions 6.3 various devices to control interrupt functions (1) interrupt request flags and interrupt enable flags the following seven interrupt request flags (irqxxx) corresponding to the interrupt sources are provided. int0 interrupt request flag (irq0) serial interface interrupt request flag (irqcsi) int1 interrupt request flag (irq1) timer/event counter interrupt request flag (irqt0) int4 interrupt request flag (irq4) timer counter interrupt request flag (irqt1) bt interrupt request flag (irqbt) an interrupt request flag is set to 1 by an interrupt request, and is automatically cleared to 0 when interrupt processing is performed. however, irqbt and irq4 are cleared in a different way because these flags share a vector address. (see section 6.6 .) the following seven interrupt enable flags (iexxx) corresponding to the interrupt request flags are provided. int0 interrupt enable flag (ie0) serial interface interrupt enable flag (iecsi) int1 interrupt enable flag (ie1) timer/event counter interrupt enable flag (iet0) int4 interrupt enable flag (ie4) timer counter interrupt enable flag (iet1) bt interrupt enable flag (iebt) an interrupt enable flag set to 1 enables the corresponding interrupt, and an interrupt enable flag set to 0 disables the corresponding interrupt. when an interrupt request flag and the interrupt enable flag are set to 1, a vectored interrupt request (vrqn: n = 1 to 6) occurs. this condition is also used to release a standby mode. a bit manipulation instruction or 4-bit memory manipulation instruction is used to manipulate an interrupt request flag and interrupt enable flag. a bit manipulation instruction allows direct manipulation regardless of mbe setting. an interrupt enable flag can be manipulated using an ei iexxx instruction or di iexxx instruction. the sktclr instruction is usually used to test an interrupt request flag. example ei ie0 ; enable int0 di ie1 ; disable int1 sktclr irqcsi ; skip and clear irqcsi when it is set to 1. when an interrupt request flag is set using an instruction, even if there is no interrupt request, a vectored interrupt is executed in the same way as when an interrupt is requested. inputting a reset signal clears the interrupt request and interrupt enable flags to 0, disabling all interrupts.
192 m pd750108 user's manual table 6-2. set signals for interrupt request flags interrupt set signals for interrupt request flags interrupt request flag enable flag irqbt set by a reference time interval signal from the basic interval timer/watchdog iebt timer. irq4 set by a detected rising or falling edge of an int4/p00 pin input signal. ie4 irq0 set by a detected edge of an int0/p10 pin input signal. ie0 the detection edge is specified by the int0 edge detection mode register (im0). irq1 set by a detected edge of an int1/p11 pin input signal. ie1 the detection edge is specified by the int1 edge detection mode register (im1). irqcsi set by a serial data transfer completion signal for the serial interface. iecsi irqt0 set by a match signal from timer/event counter 0. iet0 irqt1 set by a match signal from the timer counter. iet1 (2) interrupt priority specification register (ips) the interrupt priority specification register selects an interrupt with a higher priority from multiple interrupts using the low-order three bits. bit 3, interrupt master enable flag (ime), specifies whether to disable all interrupts. the ips is set using a 4-bit memory manipulation instruction. bit 3 is set by an ei instruction and reset by a di instruction. when changing the low-order three bits of the ips, interrupts must be disabled (ime = 0) beforehand. example di ; disable interrupts clr1 mbe mov a,#1011b mov ips,a ; assign a higher priority to int1, then enable interrupts. a reset signal clears all bits to 0. caution disable interrupts before setting the ips.
193 chapter 6 interrupt and test functions figure 6-3. interrupt priority specification register ips0 ips1 ips2 ips3 0 1 2 3 ips symbol fb2h address 000 001 010 011 100 101 110 111 0 1 high-order interrupt selection all low-order interrupt vrq1 (intbt/int4) vrq2 (int0) vrq3 (int1) vrq4 (intcsi) vrq5 (intt0) vrq6 (intt1) not to be set the listed vectored interrupts are treated as high-order interrupts. interrupt master enable flag (ime) all interrupts are disabled and no vectored interrupt is activated. the interrupt enable flag corresponding to an interrupt request flag controls interrupt enabling/disabling.
194 m pd750108 user's manual (3) configurations of the int0, int1, and int4 circuits (a) as shown in figure 6-4 (a), the int0 circuit accepts an external interrupt at its rising or falling edge. the edge to be detected can be selected. the int0 circuit has a noise elimination function (see figure 6-5 ), called a noise eliminator, using a sampling clock, which removes pulses shorter than two sampling clock cycles note as noise. the int0 circuit may accept pulses which are longer than one sampling clock cycle and shorter than two cycles as interrupts depending on the sampling timing (see figure 6-4 (a) ). the circuit is sure to accept pulses equal to or longer than two sampling clock cycles as interrupts. the int0 pin is supplied with sampling clock f or f cc /64, whichever is selected by bit 3 (im03) of the int0 edge detection mode register (im0). bit 0 (im00) and bit 1 (im01) of the int0 edge detection mode register (im0) are used to select a detection edge. figure 6-6 (a) shows the format of im0. a 4-bit memory manipulation instruction is used to set im0. a reset signal clears all bits to 0, and a rising edge is specified to be detected. note when the frequency of a sampling clock is f , these cycles are equal to 2t cy . when the frequency of a sampling clock is f cc /64, these cycles are equal to 128/f cc . cautions 1. input a pulse wider than two sampling clock cycles to the int0/p10 pin. otherwise, the pulse is suppressed as noise by a noise eliminator when the pin is used as a port. 2. when the noise eliminator is selected (im02 is set to 0), int0 does not operate in standby mode because int0 requires a clock for sampling (the noise eliminator does not operate unless the cpu clock f is supplied). do not select the noise eliminator when using int0 to release standby mode (set im02 to 1). (b) as shown in figure 6-4 (b), the int1 circuit accepts an external interrupt at its rising or falling edge. the int1 edge detection mode register (im1) is used to select a detection edge. figure 6-6 (b) shows the format of im1. a bit manipulation instruction is used to set im1. a reset signal clears all bits to 0, and a rising edge is specified to be detected. (c) as shown in figure 6-4 (c), the int4 circuit accepts an external interrupt at its rising and falling edges. *
195 chapter 6 interrupt and test functions figure 6-4. configurations of the int0, int1, and int4 circuits (a) configuration of the int0 circuit note even if f cc /64 is selected, halt mode cannot be released by int0. (b) configuration of the int1 circuit (c) configuration of the int4 circuit int0/p10 im00, im01 internal bus im0 4 edge detection circuit irq0 set signal int0 input buffer detection edge specification sampling clock selection noise eliminator selector note selector im02 im03 f cc /64 f int1/p11 im10 internal bus im1 4 edge detection circuit irq1 set signal int1 input buffer detection edge specification * int4/p00 internal bus both-edge detection circuit input buffer irq4 set signal int4
196 m pd750108 user's manual figure 6-5. i/o timing of a noise eliminator remark t smp = t cy or 64/f cc int0 shaped output int0 int0 int0 shaped output shaped output shaped output <1> shorter than sampling cycle (t smp ) <2> 1 to 2 times <3> longer than 2 times (a) (b) t smp t smp t smp t smp t smp l l h h l l h l l l h h l l "l" "l" removed as noise removed as noise
197 chapter 6 interrupt and test functions figure 6-6. format of edge detection mode registers (a) int0 edge detection mode register (im0) (b) int1 edge detection mode register (im1) caution changing the edge detection mode register may set an interrupt request flag. so, disable the interrupts before changing the edge detection mode register. then clear the interrupt request flag with a clr1 instruction and enable the interrupts. when f cc /64 is selected as a sampling clock pulse in changing im0, wait for 16 machine cycles after changing the mode register and clear the interrupt request flag. fb5h address 0 1 specifies rising edge. specifies falling edge. detection edge specification im10 3 0 2 0 1 0 0 im10 im1 symbol fb4h address 0 0 specifies rising edge. specifies falling edge. detection edge specification 0 1 1 1 0 1 im01 im00 specifies both rising and falling edges. ignored (no interrupt request flag is set.) 3 im03 2 im02 1 im01 0 im00 im0 symbol 0 1 selects a noise eliminator. does not select a noise eliminator. noise eliminator selection bit enabled disabled im02 sampling cannot be released can be released standby mode 0 1 f (2, 4, 8, 32 s at 2 mhz, 4, 8, 16, 64 s at 1 mhz) f cc /64 (32 s at 2 mhz, 64 s at 1 mhz) sampling clock im03
198 m pd750108 user's manual (4) interrupt status flags the interrupt status flags (ist0 and ist1), which are contained in the psw, indicate the status of processing currently executed by the cpu. by using the content of these flags, the interrupt priority control circuit controls multiple interrupts as indicated in table 6-3. a 4-bit manipulation instruction or bit manipulation instruction can be used to set and reset ist0 and ist1, so that multiple interrupts are enabled by changing the current status of execution. ist0 and ist1 can be manipulated on a single-bit basis at any time regardless of mbe setting. before ist0 or ist1 is manipulated, the di instruction must be executed to disable interrupts, then the ei instruction must be executed to enable interrupts. ist1 and ist0 as well as the other psw bits are saved in the stack memory when an interrupt is accepted and the status of ist0 and ist1 changes to a status one level higher. when a reti instruction is executed, the former values of ist1 and ist0 are resumed. inputting a reset signal clears the content of the flag to 0. table 6-3. interrupt processing statuses of ist0 and ist1 ist1 ist0 processing cpu operation interrupts that after acceptance status can be accepted ist1 ist0 0 0 status 0 is processing the normal program. all 0 1 0 1 status 1 is processing a low- or high-order only high-order 1 0 interrupt. interrupts 1 0 status 2 is processing a high-order interrupt. no 1 1 not to be set
199 chapter 6 interrupt and test functions 6.4 interrupt sequence when an interrupt occurs, it is processed using the procedure shown in figure 6-7. figure 6-7. interrupt sequence notes 1. ist0 and ist1 are the interrupt status flags (bits 3 and 2 of the psw). (see table 6-3 .) 2. an interrupt service program start address and mbe and rbe setting values at the start of interrupt are stored in each vector table. no yes yes no yes no no yes no yes interrupt (intxxx) occurrence irqxxx setting iexxx set? hold until iexxx is set. corresponding vrqn occurrence ime = 1 hold until ime is set. is vrqn high-order interrupt? note 1 ist1, 0 = 00 or 01 if two or more vrqns occur, select one vrqn according to table 6-1. selected vrqn remaining vrqns save contents of pc and psw in stack memory and set data note 2 in vector table corresponding to activated vrqn to pc, rbe, and mbe. change contents of ist0 and ist1 from 00 to 01 or from 01 to 10. reset accepted irqxxx. see section 6.6 when those interrupt sources share vector address. jump to the start address for processing the interrupt service program. hold until process- ing being executed is finished. note 1 ist1, 0 = 00
200 m pd750108 user's manual 6.5 multiple interrupt processing control the m pd750108 can handle multiple interrupts by either of the following methods. (1) multiple interrupt processing by a high-order interrupt in this method, the m pd750108 selects an interrupt source among multiple interrupt sources, enabling double interrupt processing. that is, the high-order interrupt specified by the interrupt priority specification register (ips) is enabled when the processing status is 0 or 1. other interrupts (interrupts lower than the specified high-order interrupt) are enabled only when the status is 0. (see figure 6-8 and table 6-3 .) when only one interrupt is used as a level-two interrupt, using this method saves the user the trouble of enabling or disabling interrupts during an interrupt processing, and holds down the number of nesting levels to two. figure 6-8. multiple interrupt processing by a high-order interrupt normal processing (status 0) low- or high-order interrupt processing (status 1) high-order interrupt processing (status 2) interrupt is disabled. ips setting interrupt is enabled. low- or high-order interrupt occurrence high-order interrupt occurrence
201 chapter 6 interrupt and test functions (2) multiple interrupt processing by changing the interrupt status flags changing the interrupt status flags with the program causes multiple interrupts to be enabled. that is, when the interrupt processing program changes both ist1 and ist0 to 0 (status 0), multiple interrupt processing is enabled. this method is used when two or more interrupts are to be enabled at a time or when the processing of three or more interrupts is to be performed. when changing ist1 and ist0, interrupts must be disabled beforehand with a di instruction. figure 6-9. multiple interrupt processing by changing the interrupt status flags low- or high-order interrupt occurrence normal processing (status 0) single interrupt dual interrupts interrupt is enabled. low- or high-order interrupt occurrence interrupt is disabled. modification of ist interrupt is enabled. status 1 status 0 status 0 status 1 ips setting interrupt is disabled.
202 m pd750108 user's manual 6.6 processing of interrupts sharing a vector address interrupt sources intbt and int4 share a vector table, so an interrupt source is selected as described below. (1) using only one interrupt the interrupt enable flag for desired one of the two interrupt sources sharing a vector table is set to 1, and the interrupt enable flag for the other is cleared to 0. in this case, the enabled (iexxx = 1) interrupt source causes an interrupt request. when the interrupt request is accepted, the interrupt request flag is reset. (2) using both interrupts the interrupt enable flags corresponding to the two interrupt sources are both set to 1. in this case, the logical sum of the interrupt request flags for the two interrupt sources is used as an interrupt request. in this case, even if an interrupt request or interrupt requests caused by the setting of one or both of the interrupt request flags are accepted, the interrupt request flag or flags are not reset. accordingly, which of the two interrupt sources caused the interrupt needs to be determined using the interrupt service routine. for this determination, the di instruction is to be executed at the start of the interrupt service routine, and the interrupt request flags are checked with the sktclr instruction. if both the request flags are set when this request flag is tested or cleared, the interrupt request remains even if one of the request flags is cleared. if this interrupt is selected as having the higher priority, nesting processing is started by the remaining interrupt request. consequently, the interrupt request not tested is processed first. if the selected interrupt has the lower priority, the remaining interrupt is kept pending and therefore, the interrupt request tested is processed first. therefore, an interrupt sharing a vector address with another interrupt is identified differently, depending whether it has the higher priority, as shown in table 6-4. table 6-4. identifying interrupt sharing vector table address with higher priority interrupt is disabled and interrupt request flag of interrupt that takes precedence is tested with lower priority interrupt request flag of interrupt that takes precedence is tested
203 chapter 6 interrupt and test functions examples 1. to use both intbt and int4 as having the higher priority and give priority to int4 di sktclr irq4 ; irq4 = 1 ? br vsubbt processing routine ei of int4 reti vsubbt: clr1 irqbt processing routine of intbt ei reti 2. to use both intbt and int4 as having the lower priority and give priority to int4 sktclr irq4 ; irq4 = 1 ? br vsubbt processing routine of int4 reti vsubbt: clr1 irqbt processing routine of intbt reti . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
204 m pd750108 user's manual 6.7 machine cycles for starting interrupt processing with the m pd750108 series, the following machine cycles are used to start the execution of the interrupt service routine after an interrupt request flag (irqxxx) is set. (1) when irqxxx is set during execution of an interrupt control instruction when irqxxx is set during execution of an interrupt control instruction, an instruction preceded by that instruction is executed, and an interrupt processing of three machine cycles is executed, then the interrupt service routine is started. a: irqxxx is set. b: the next instruction is executed (1 to 3 machine cycles according to the instruction). c: interrupt processing (3 machine cycles) d: interrupt service routine is executed. cautions 1. when interrupt control instructions are contiguous these interrupt control instruc- tions are executed up to the last one. an instruction preceded by the interrupt control instruction executed last is executed, and an interrupt processing of three machine cycles is executed, then the interrupt service routine is started. 2. when a di instruction is executed in the period during which irqxxx is set (a in the figure), or in the immediately following period, the interrupt request of the set irqxxx is held until an ei instruction is executed. remarks 1. an interrupt control instruction manipulates hardware (address fbxh in data memory) which handles interrupt processings. there are two types of interrupt control instruction, a di instruction and an ei instruction. 2. three machine cycles required for the interrupt processing include the time to manipulate the stack when an interrupt is accepted. ab cd interrupt control instruction
205 chapter 6 interrupt and test functions (2) when irqxxx is set during an instruction other than that described in (1) (a) when irqxxx is set at the last machine cycle of the instruction being executed in this case, an instruction preceded by the instruction being executed is executed, and an interrupt processing of three machine cycles is executed, then the interrupt service routine is started. a: irqxxx is set. b: the next instruction is executed (1 to 3 machine cycles to the instruction). c: interrupt processing (3 machine cycles) d: interrupt service routine is executed. caution when one or more interrupt control instructions follow, an instruction preceded by the interrupt control instructions is executed, and an interrupt processing of three machine cycles is executed, then the interrupt service routine is started. when an instruction to be executed after setting irqxxx is a di instruction, the interrupt request of the set irqxxx is held. (b) when irqxxx is set earlier than the last machine cycle of the instruction being executed in this case, after executing the instruction being executed, an interrupt processing of three machine cycles is executed, then the interrupt service routine is started. a: irqxxx is set. c: interrupt processing (3 machine cycles) d: interrupt service routine is executed. ab c d an instruction other than interrupt control instruction acd an instruction other than interrupt control instruction
206 m pd750108 user's manual 6.8 effective use of interrupts the interrupt function can be used more effectively in the ways described below. (1) mbe = 0 is set for the interrupt service routine by allocating addresses 00h to 7fh as data memory used by the interrupt service routine and specifying mbe = 0 in an interrupt vector table, the user can code a program without being concerned with a memory bank. if a program must use memory bank 1 for some reason, save the memory bank select register using the push bs instruction before selecting memory bank 1. (2) use different register banks for the normal routine and interrupt routine. the normal routine uses register banks 2 and 3 with rbe = 1 and rbs = 2. if the interrupt routine is for one nested interrupt, use register bank 0 with rbe = 0, so that you do not have to save or restore the registers. when two or more interrupts are nested, set rbe to 1, save the register bank by using the push bs instruction, and set rbs to 1 to select register bank 1. (3) use of a software interrupt for debugging setting an interrupt request flag using an instruction has the same effect as the occurrence of an interrupt. debug operation for irregular interrupts or concurrently occurring interrupts can be performed more efficiently by setting the interrupt request flags using an instruction. 6.9 interrupt applications to use the interrupt function, a main program must: (a) set a desired interrupt enable flag (using the ei iexxx instruction) (b) select an active edge when int0 or int1 is used (set im0 or im1) (c) to use nesting (of an interrupt with the higher priority), set ips (ime can be set at the same time). (d) set the interrupt master enable flag (ime) using the ei instruction in the interrupt routine, mbe and rbe are set by the vector table. however, when the interrupt specified as having the higher priority is processed, the register bank must be saved and set. to return from the interrupt routine, use the reti instruction.
207 chapter 6 interrupt and test functions (1) interrupt enable/disable <1> a reset signal disables all interrupts. <2> interrupt enable flags are set by the ei iexxx instruction. at this stage, all interrupts are disabled. <3> the interrupt master enable flag is set by the ei instruction. at this stage, int0 and intt0 are enabled. <4> an interrupt enable flag is cleared by the di iexxx instruction to disable int0. <5> the di instruction disables all interrupts. interrupt disabled int0 and intt0 enabled intt0 enabled interrupt disabled
<1> reset <2> ei ie0 ei iet0 <3> ei <4> di ie0 <5> di ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
208 m pd750108 user's manual (2) example of using intbt, int0 (falling edge active), and intt0 without multiple interrupt processing <1> a reset signal disables all interrupts, setting status 0. <2> int0 is set to be falling edge active. <3> interrupts are enabled by the ei and ei iexxx instructions. <4> on the falling edge of int0, the int0 interrupt service program is started, status is set to 1, and all interrupts are disabled. <5> control is returned from the interrupts by the reti instruction, status 0 is set again, and interrupts are enabled. remark if all the interrupts are used as having the lower priority as shown in this example, saving or restoring the register bank is not necessary if rbe = 1 and rbs = 2 for the main program and register banks 2 and 3 are used, and rbe = 0 for the interrupt service program and register banks 0 and 1 are used. ; rbe = 1, mbe = 0
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? reset <2> mov status 0 status 0 status 1 a, #1 mov im0, a clr1 irq0 <3> ei iebt ei ie0 ei iet0 ei <4> int0 <5> reti <1> ; rbe = 0
209 chapter 6 interrupt and test functions (3) nesting of interrupts with higher priority (intbt has higher priority and intt0 and intcsi have lower priority) <1> intbt is specified as having the higher priority by setting of ips, and the interrupt is enabled at the same time. <2> intt0 service program is started when intt0 with the lower priority occurs. status 1 is set and the other interrupts with the lower priority are disabled. rbe = 0 to select register bank 0. <3> intbt with the higher priority occurs. the level-two interrupts occurs. the status is changed to 0 and all the interrupts are disabled. <4> rbe = 1 and rbs = 1 to select register bank 1 (only the registers used may be saved by the push instruction). <5> rbs is returned to 2, and execution returns to the main program. the status is returned to 1. reset status 0 status 0 status 1 ; rbe = 1, mbe = 0 sel ei ei ei mov mov rb2 iebt iet0 iecsi a, #9 ips, a <1> <2> intt0 <5> reti ; rbe = 0 status 1 <4> ; rbe = 1 sel rb1 sel rb2 reti status 2 <3> intbt
210 m pd750108 user's manual (4) execution of held interrupts (interrupt requests when interrupts are disabled) <1> if int0 is set when interrupts are disabled, the interrupt request flag is held. <2> when the interrupt is enabled by the ei instruction, the int0 interrupt service program starts. <3> same as <1> <4> when the held intcsi flag is enabled, the intcsi interrupt service program starts. reti ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? reset <2> ei <1> int0 <3> intcsi ei ie0 reti ei iecsi <4> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
211 chapter 6 interrupt and test functions (5) execution of held interrupts C two interrupts with lower priority occur concurrently C <1> when int0 and intt0 with the lower priority occur concurrently (during execution of the same instruction), int0, with a higher priority, is executed first. (intt0 is held.) <2> when the int0 interrupt service program has been executed, the reti instruction is executed to start the interrupt service program for intt0, which has been held. reset <2> reti <1> ei iet0 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
int0 intt0 ei ie0 ei reti
212 m pd750108 user's manual (6) executing pending interrupt C interrupt occurs during interrupt processing (intbt has higher priority and intt0 and intcsi have lower priority) C <1> when intbt with the higher priority and intt0 with the lower priority occur at the same time, the processing of the interrupt with the higher priority is started (if there is no possibility that an interrupt with the higher priority occurs while another interrupt with the higher priority is processed, di iexx is not necessary). <2> when an interrupt with the lower priority occurs while the interrupt with the higher priority is executed, the interrupt with the lower priority is kept pending. <3> when the interrupt with the higher priority has been processed, intcsi with the higher priority of the pending interrupts is executed. <4> when the processing of intcsi has been completed, the pending intt0 is processed.
reset ei ei ei mov mov iebt iet0 iecsi a, #9 ips, a intt0 reti intbt <4> reti <3> reti pop rp push rp <2> intcsi <1>
213 chapter 6 interrupt and test functions (7) enabling of level-two interrupts (enabling level-two intt0 and int0 interrupts with intcsi and int4 handled as level-one interrupts) <1> when an intcsi interrupt not allowed to be a level-two interrupt occurs, the intcsi service program starts, and status 1 is set. <2> status 0 is set by clearing ist0. intcsi and int4 not allowed to be level-two interrupts are disabled. <3> when intt0 allowed to be a level-two interrupt occurs, the level-two interrupt is executed, and status 1 is set to disable all interrupts. <4> when intt0 processing is completed, status 0 is set again. <5> intcsi and int4 which have been disabled are enabled, then control returns. reset ei iet0
ei ie0 ei iecsi status 0 status 0 status 0 status 1 status 0 status 1 <3> intt0 <2> di clr1 ist0 di iecsi di ie4 ei <4> reti ei iecsi ei ie4 reti <5> <1> intcsi ei ie4 ei ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
214 m pd750108 user's manual 6.10 test function 6.10.1 test sources the m pd750108 has two test sources. int2 provides two types of edge-detection-test inputs. table 6-5. test source test source internal/external int2 (detection of the rising edge of the signal input to the int2 pin or that of external the first falling edge of the signals input to kr0 to kr7) intw (signal from clock timer) internal 6.10.2 hardware to control test functions (1) test request flags, test enable flags test request flags (irqxxx) are set to 1 when the corresponding test requests (intxxx) are issued. clear the test request flags to 0 with the software once the test processing has been executed. test enable flags (iexxx) correspond to test request flags. the test enable flags enable the standby release signal when they are set to 1. they disables the standby release signal when they are set to 0. when both a test request flag and the corresponding test enable flag are set to 1, the standby release signal is generated. table 6-6 shows the signals which set test request flags. table 6-6. signals setting test request flags test request flag signals setting test request flags test enable flag irqw signal from the clock timer. iew irq2 detection of the rising edge of int2/p12 pin input signal or ie2 the first falling edge of the signals input to the kr0/p60 to kr7/p73 pins. the detection edge is selected with the int2 edge detection mode register (im2).
215 chapter 6 interrupt and test functions (2) int2 and key interrupt (kr0 to kr7) hardware figure 6-10 shows the configuration of int2 and kr0 to kr7. the irq2 set signal is output in either of the following edge detection modes, which is selected with the int2 edge detection mode register (im2). (a) detection of a rising edge on the int2 input pin irq2 is set when a rising edge is detected on the int2 input pin. (b) detection of a falling edge on any of the kr0 to kr7 input pins (key interrupt) one of the pins kr0 to kr7 is selected to be used for interrupt input with the int2 edge detection mode register (im2). when a falling edge of one of input signals applied to the selected pin is detected, irq2 is set. figure 6-11 shows the format of im2. im2 is set using a 4-bit manipulation instruction. when the reset signal is generated, all bits are cleared to 0, and the rising edge on int2 is specified.
216 m pd750108 user's manual figure 6-10. block diagram of the int2 and kr0 to kr7 circuits int2/p12 kr7/p73 kr6/p72 kr5/p71 kr4/p70 kr3/p63 kr2/p62 kr1/p61 kr0/p60 im2 4 input buffer internal bus selector rising edge detection circuit falling edge detection circuit int2 (irq2 set signal) im20, im21
217 chapter 6 interrupt and test functions figure 6-11. format of int2 edge detection mode register (im2) cautions 1. when the edge detection mode register is modified, test request flags may be set in some cases. so, disable test inputs before modifying the edge detection mode register. then, clear the test request flags using a clr1 instruction before enabling test inputs. 2. when a low-level signal is applied to any of the pins subjected to falling edge detection, irq2 is not set when a falling edge is detected on another pin. 0 0 im21 im20 fb6h im2 im21 0 0 1 1 im20 0 1 0 1 specifies rising edge of int2 pin input. interrupt input pin int2 kr4 - kr7 (4) kr2 - kr7 (6) kr0 - kr7 (8) specifies falling edge of any of krx pin inputs. int2 interrupt source 0 1 2 3 symbol address (1)
218 m pd750108 user's manual [memo]
219 chapter 7 standby function chapter 7 standby function the m pd750108 provides a standby function to reduce the power consumption by the system. the standby function is available in the two modes: the stop mode and halt mode. differences between these two modes are as follows: (1) stop mode in the stop mode, the main system clock oscillator is stopped, and the entire system stops. the current used by the cpu is reduced to quite a low level. in addition, the contents of data memory can be preserved with a low supply voltage of down to v dd = 1.8 v, that is, this mode is effective to retain data memory with a very low current. the wait time applied when stop mode is released by an interrupt request can be specified as 2 9 /f cc or no wait, by using a mask option. to start processing immediately upon the detection of an interrupt request, select no wait. the m pd75p0116, however, does not have a mask option and its wait time is fixed to 2 9 /f cc . if 2 9 /f cc has been selected and processing must be started immediately upon the detection of an interrupt request, select halt mode. (2) halt mode in the halt mode, the cpu clock is stopped, but the oscillation of the system clock oscillator continues. in this mode, the system uses more current than in the stop mode. however, the halt mode is suitable for starting processing immediately after an interrupt request or for intermittent operations such as watch operation. in either mode, all contents of the registers, flags, and data memory that are present immediately before the standby mode is set are preserved. in addition, the states of the output latches of the i/o ports and the states of the output buffers are also preserved, so that the states of the i/o ports are to be processed to minimize the power consumption of the entire system. cautions 1. the stop mode can be used only for the main system clock. (subsystem clock generation cannot be terminated.) the halt mode can be used for either the main system clock or the subsystem clock. 2. if the stop mode is set when main system clock f cc is used for clock timer operation, the clock stops operating. for continued operation, the clock must be changed to subsystem clock f xt before the stop mode is set. 3. a lower power consumption and lower-voltage operation are enabled by switching standby modes or switching cpu and system clocks. however, a switching time as described in section 5.2.3 is required before operation is started with a new clock after the clock is selected with the control register. for this reason, when the clock switching function is used together with a standby mode, the standby mode must be set after a time needed for switching elapses. 4. configure i/o ports for minimum power consumption in the stand by mode. be sure to connect signals which are high or low to input ports. 7
220 m pd750108 user's manual 7.1 setting of standby modes and operation status table 7-1. operation statuses in the standby mode notes 1. operation is possible only when the main system clock operates. 2. operation is possible only when the noise eliminator is not selected by bit 2 of the edge detection mode register (im0) (when im02 = 1). a stop instruction is used to set the stop mode, and a halt instruction is used to set the halt mode. (a stop instruction sets bit 3 of pcc, and a halt instruction sets bit 2 of pcc.) stop instruction or halt instruction must always be followed by an nop instruction. when changing a cpu operation clock pulse with the low-order two bits of pcc, a time lag may occur from the time when pcc is rewritten as shown in table 5-5 to the time when the cpu clock signal is changed. when changing an operation clock pulse before the standby mode or a cpu clock signal after the standby mode is released, it is necessary to rewrite pcc and set the standby mode after as many machine cycles as required to change the cpu clock pulse have elapsed. in a standby mode, the contents of all registers and data memory that are stopped during the standby mode, including general registers, flags, mode registers, and output latches, are retained. halt mode halt instruction can be set either with the main system clock or the subsystem clock only the cpu clock f stops its operation (oscillation continues) can operate only at main system clock oscillation. (irqbt is set at reference time intervals.) can operate only when external sck input is selected as the serial clock or at main system clock oscillation. can operate only when ti0 pin input is specified as the count clock or at main system clock oscillation. can operate note 1 can operate stop mode stop instruction can be set only when operating on the main system clock the main system clock stops its operation does not operate can operate only when the external sck input is selected for the serial clock can operate only when the ti0 pin input is selected for the count clock does not operate can operate when f xt is selected as the count clock int1, int2, and int4 can operate. only int0 cannot operate. note 2 does not operate operation status item an interrupt request signal from hardware whose operation is enabled by the interrupt enable flag or the generation of a reset signal mode instruction for setting system clock for setting clock oscillator basic interval timer/watchdog timer serial interface timer/event counter timer counter clock timer external interrupt cpu release signal
221 chapter 7 standby function caution reset all the interrupt request flags before setting the standby mode. if an interrupt source whose interrupt request flag and interrupt enable flag are both set exists, the initiated standby mode is released immediately after it is set (see figure 6-1). when the stop mode is set, however, the m pd750108 enters the halt mode immediately after the stop instruction is executed, then returns to the operation mode after the specified wait time note has elapsed. note either of the following can be selected by using a mask option: ?2 9 /f cc (256 m s at 2 mhz, 512 m s at 1 mhz) no wait the m pd75p0116, however, does not have a mask option. its wait time is fixed to 2 9 /f cc . 7.2 release of the standby modes the stop mode and halt mode are released by a reset signal or the generation of an interrupt request signal that is enabled with the interrupt enable flag. figure 7-1 shows how the stop and halt modes are released. figure 7-1. standby mode release operation (1/2) (a) release of the stop mode by reset signal (b) release of the stop mode by the occurrence of an interrupt stop instruction standby release signal clock operating mode stop mode halt mode operating mode no oscillation oscillation oscillation wait note 2 stop instruction wait reset signal clock operating mode stop mode halt mode operating mode no oscillation oscillation oscillation note 1
222 m pd750108 user's manual notes 1. 56/f cc (28 m s at 2 mhz, 56 m s at 1 mhz) 2. either of the following can be selected by using a mask option: ?2 9 /f cc (256 m s at 2 mhz, 512 m s at 1 mhz) no wait the m pd75p0116, however, does not have a mask option. its wait time is fixed to 2 9 /f cc . remark the dashed line indicates the case where the interrupt request that releases the standby mode is accepted. figure 7-1. standby mode release operation (2/2) (c) release of the halt mode by reset signal (d) release of the halt mode by the occurrence of an interrupt note 56/f cc (28 m s at 2 mhz, 56 m s at 1 mhz) remark the dashed line indicates the case where the interrupt request that releases the standby mode is accepted. halt instruction reset signal clock operating mode halt mode operating mode oscillation wait note halt instruction standby release signal clock halt mode operating mode oscillation operating mode
223 chapter 7 standby function 7.3 operation after a standby mode is released (1) if a standby mode is released by a reset signal, normal reset operation is performed. (2) if a standby mode is released by the occurrence of an interrupt request, the contents of the interrupt master enable flag (ime) determines whether to perform a vectored interrupt when the cpu resumes instruction execution. (a) when ime = 0 if a standby mode is released, execution restarts with the instruction immediately following the instruction used to set the standby mode. the interrupt request flag is held. (b) when ime = 1 if a standby mode is released, a vectored interrupt is executed after the two instructions are executed. however, if the standby mode is released by int2 or intw (testable input), no vectored interrupt occurs, and the same processing as (a) above is performed. 7.4 selection of a mask option for the standby function of the m pd750108, the wait time applied when stop mode is released by an interrupt can be set to either of the following by using a mask option: <1> 2 9 /f cc (256 m s at 2 mhz, 512 m s at 1 mhz) <2> no wait the m pd75p0116, however, does not have a mask option. its wait time is fixed to 2 9 /f cc .
224 m pd750108 user's manual 7.5 applications of the standby modes when the standby modes are used, the following steps are used. <1> detect a standby mode setting factor such as power removal on an interrupt input or port input. (int4 is useful for power removal detection.) <2> configure i/o ports for minimum current drain. <3> specify interrupts for releasing a standby mode. (int4 is useful. all interrupt enable flags not used for release are to be cleared.) <4> specify an operation to be performed after release. (ime is to be manipulated according to whether interrupt processing is performed or not.) <5> specify a cpu clock to be used after release. (if the cpu clock is changed, required machine cycles must elapse before the standby mode is set.) <6> select a wait time to be used when a standby mode is released. <7> set a standby mode using a stop or halt instruction. a standby mode when combined with the system clock switch function enables a lower power consumption and lower-voltage operation. (1) application of the stop mode (at f cc = 1 mhz) ? the stop mode is set on the falling edge of int4, and is released on the rising edge of int4. (intbt is not used.) ? all i/o ports have a high impedance. ? the int0 and intt0 interrupts are used for the program, but are not used to release the stop mode. ? after the stop mode is released, interrupts are enabled. ? after the stop mode is released, operation is started using the lowest-speed cpu clock. ? the wait time applied when the stop mode is released is set to 512 m s by using a mask option. after the stop mode is released, another wait time of 32.8 ms is used for stable power supply operation. the p00/int4 pin is checked twice to remove chattering.
225 chapter 7 standby function (int4 service program, mbe = 0) vsub4: skt port0.0 ; p00 = 1? br pdown ; power-down mov a,#1101b mov btm,a ; wait time = 32.8 ms wait: skt irqbt ; wait for 512 m s. br wait skt port0.0 ; chattering check br pdown mov a,#0011b mov pcc,a ; set high-speed mode. mov xa.#xxh ; set port mode register. mov pmgm,xa ei ie0 ei iet0 reti pdown: mov a,#0 ; lowest-speed mode mov pcc,a mov xa,#00h mov pmga,xa ; i/o port high impedance mov pmgb,xa di ie0 ; disable int0 and intt0 di iet0 stop ; set stop mode. nop reti * int4 int4 512 s 32.8 ms halt mode (wait) low-speed operation stop mode operating mode stop instruction v dd 0 v p00/int4 cpu operation voltage on v dd high-speed operation
226 m pd750108 user's manual (2) application of the halt mode (at f cc = 1 mhz) ? the main system clock is switched to the subsystem clock on the falling edge of int4. ? the oscillation of the main system clock is stopped, and halt mode is set. ? in the standby mode, intermittent operation is performed at intervals of 0.5 s. ? the subsystem clock is switched back to the main system clock on the rising edge of int4. ? intbt is not used. ? after the stop mode is released, another wait time of 32.8 ms is used for stable power supply operation. the p00/int4 pin is checked twice to remove chattering. int4 int4 32.8 ms operating mode (low-speed) intermittent operation (halt mode + low-speed operation) operating mode v dd 0 v p00/int4 cpu operation voltage on v dd operating mode (high-speed) *
227 chapter 7 standby function (initialization) mov a,#0011b mov pcc,a ; high-speed mode mov xa,#05 mov wm,xa ; subsystem clock ei ie4 ei iew ei ; enable interrupt (main routine) skt port0.0 ; power normal? halt ; power-down mode nop ; power normal? sktclr irqw ; flag set for 0.5 second? br main ; no call watch ; clock subroutine main: . . . . . . . . . . (int4 service routine) vint4: skt port0.0 ; power normal? mbe = 0 br pdown clr1 scc.3 ; start main system clock oscillation mov a,#0dh mov btm,a wait1: skt irqbt ; wait for 32.8 ms br wait1 skt port0.0 ; chattering check br pdown clr1 scc.0 ; switch to main system clock reti pdown: set1 scc.0 ; switch to subsystem clock mov a,#0ah wait2: incs a ; wait for 15 machine cycles br wait2 set1 scc.3 ; stop main system clock oscillation reti caution before the system clock is changed from the main system clock to the subsystem clock, a wait time sufficient for stable subsystem clock generation is required.
228 m pd750108 user's manual [memo]
229 chapter 8 reset function chapter 8 reset function the m pd750108 is reset with the external reset signal (reset) or the reset signal received from the basic interval timer/watchdog timer. when either reset signal is input, the internal reset signal is generated. figure 8-1 shows the configuration of the reset circuit. figure 8-1. configuration of reset functions when the reset signal is generated, all hardware is initialized as indicated in table 8-1. figure 8-2 shows the reset operation timing. figure 8-2. reset operation by generation of reset signal note 56/f cc (28 m s at 2 mhz, 56 m s at 1 mhz). 8 wdtm reset internal reset signal reset signal from basic interval timer/watchdog timer internal bus reset signal is generated operating mode or standby mode halt mode operating mode internal reset operation wait note
230 m pd750108 user's manual table 8-1. status of the hardware after a reset (1/2) program counter (pc) psw stack pointer (sp) stack bank selection register (sbs) data memory (ram) general registers (x, a, h, l, d, e, b, c) bank selection register (mbs, rbs) basic interval timer/watch- dog timer timer/ event counter timer counter clock timer serial interface m PD750104 m pd750106, m pd750108 m pd75p0116 generation of a reset signal in a standby mode 4 low-order bits at address 0000h in program memory are set in pc bits 11 to 8, and the data at address 0001h are set in pc bits 7 to 0. 5 low-order bits at address 0000h in program memory are set in pc bits 12 to 8, and the data at address 0001h are set in pc bits 7 to 0. 6 low-order bits at address 0000h in program memory are set in pc bits 13 to 8, and the data at address 0001h are set in pc bits 7 to 0. held 0 0 bit 6 at address 0000h in program memory is set in rbe, and bit 7 is set in mbe. undefined 1000b held held 0, 0 undefined 0 0 0 ffh 0 0, 0 0 ffh 0 0, 0 0 held 0 0 held carry flag (cy) skip flags (sk0 to sk2) interrupt status flags (ist0, ist1) bank enable flags (mbe, rbe) counter (bt) mode register (btm) watchdog timer enable flag (wdtm) counter (t0) modulo register (tmod0) mode register (tm0) toe0, tout flip-flop counter (t1) modulo registers (tmod1) mode register (tm1) toe1, tout flip-flop mode register (wm) shift register (sio) operation mode register (csim) sbi control register (sbic) slave address register (sva) generation of a reset signal during operation 4 low-order bits at address 0000h in program memory are set in pc bits 11 to 8, and the data at address 0001h are set in pc bits 7 to 0. 5 low-order bits at address 0000h in program memory are set in pc bits 12 to 8, and the data at address 0001h are set in pc bits 7 to 0. 6 low-order bits at address 0000h in program memory are set in pc bits 13 to 8, and the data at address 0001h are set in pc bits 7 to 0. undefined 0 0 bit 6 at address 0000h in program memory is set in rbe, and bit 7 is set in mbe. undefined 1000b undefined undefined 0, 0 undefined 0 0 0 ffh 0 0, 0 0 ffh 0 0, 0 0 undefined 0 0 undefined hardware *
231 chapter 8 reset function table 8-1. statuses of the hardware after a reset (2/2) processor clock control register (pcc) system clock control register (scc) clock output mode register (clom) interrupt request flag (irqxxx) interrupt enable flag (iexxx) priority selection register (ips) int0, int1, and int2 mode registers (im0, im1, im2) output buffer output latch i/o mode registers (pmga, pmgb, pmgc) pull-up resistor specification register (poga, pogb) hardware generation of a reset signal during operation 0 0 0 0 reset (0) 0 0 0, 0, 0 off clear (0) 0 0 undefined sub-oscillator control register (sos) clock generator, clock output circuit interrupt digital ports generation of a reset signal in a standby mode 0 0 0 0 reset (0) 0 0 0, 0, 0 off clear (0) 0 0 held bit sequential buffers (bsb0 to bsb3)
232 m pd750108 user's manual [memo]
233 chapter 9 writing to and verifying program memory (prom) chapter 9 writing to and verifying program memory (prom) the program memory in the m pd75p0116 consists of a one-time prom (16384 x 8 bits). writing to and verifying the contents of the one-time prom is accomplished by using the pins shown in the table below. note that address inputs are not used; instead, the address is updated using the clock input from the cl1 pin. pin name function v pp voltage is applied to this pin when writing to the program memory or verifying its contents (normally v dd electric potential). cl1, cl2 an address update clock, used when writing to program memory or verifying its contents, is input to the cl1 pin. leave the cl2 pin open. md0 to md3 operation mode selection pins used when writing to the program memory or verifying its contents. d0/p40 to d3/p43 i/o pins for 8-bit data used when writing to the program memory or verifying (low-order four bits) its contents. d4/p50 to d7/p53 (high-order four bits) v dd power voltage is applied to this pin. during normal operation, 1.8 to 5.5 v should be applied; +6 v should be applied when writing to the program memory or verifying its contents. cautions 1. the m pd75p0116cu/gb does not have an erasure window, so the erasing with ultraviolet radiation cannot be performed. 2. handle the pins not used for writing to or verifying the program memory, as follows: ? pins other than xt2: connect these pins to v ss through pull-down resistors. ? xt2 pin: open 9
234 m pd750108 user's manual 9.1 operating modes when writing to and verifying the program memory if +6 v is applied to the v dd pin and +12.5 v is applied to the v pp pin, the m pd75p0116 enters program memory write/verify mode. the specific operating mode is then selected by the setting of the md0 through md3 pins as listed in the table below. operating mode specification operating mode v pp v dd md0 md1 md2 md3 +12.5 v +6 v h l h l program memory address clear mode l h h h write mode l l h h verify mode h x h h program inhibit mode remark x indicates l or h. 9.2 writing to the program memory the procedure for writing to program memory is described below; high-speed write is possible. (1) pull low all unused pins to v ss by means of resistors. bring cl1 to low level. (2) apply 5 v to v dd and to v pp . (3) wait 10 m s. (4) select program memory address clear mode. (5) apply 6 v to v dd and 12.5 v to v pp . (6) select write mode for 1 ms duration and write data. (7) select verify mode. if write is successful, proceed to step (8). if write fails, repeat steps (6) and (7). (8) perform additional write for (number of repetitions of steps (6) and (7)) x 1 ms duration. (9) increment the program memory address by inputting four pulses on the cl1 pin. (10) repeat steps (6) to (9) until the last address is reached. (11) select program memory address clear mode. (12) apply 5 v to v dd and to v pp . (13) turn the power off. *
235 chapter 9 writing to and verifying program memory (prom) the timing for steps (2) to (9) is shown below. v pp v dd v pp v dd+1 v dd v dd cl1 d0/p40-d3/p43 d4/p50-d7/p53 md0/p30 md1/p31 md2/p32 md3/p33 write verify additional write address increment repeat x times data input data output data input
236 m pd750108 user's manual 9.3 reading the program memory the procedure for reading the contents of program memory is described below. the read is performed in the verify mode. (1) pull low all unused pins to v ss by means of resistors. bring cl1 to low level. (2) apply 5 v to v dd and v pp . (3) wait 10 m s. (4) select program memory address clear mode. (5) apply 6 v to v dd and 12.5 v to v pp . (6) select verify mode. data is output sequentially one address at a time for each cycle of four clock pulses appearing on the cl1 pin. (7) select program memory address clear mode. (8) apply 5 v to v dd and to v pp . (9) turn the power off. the timing for steps (2) to (7) is shown below. * v pp v dd v pp v dd+1 v dd v dd cl1 d0/p40-d3/p43 d4/p50-d7/p53 md0/p30 md1/p31 md2/p32 md3/p33 data output data output l
237 chapter 9 writing to and verifying program memory (prom) 9.4 screening of one-time prom because of its structure, it is difficult for nec to completely test the one-time prom product before shipment. it is therefore recommended that screening be performed to verify the prom contents after the necessary data has been written to the prom and the product has been stored under the following conditions. storage temperature storage time 125 c 24 hours
238 m pd750108 user's manual [memo]
239 chapter 10 mask option chapter 10 mask option 10.1 pin the pins of the m pd750108 have the following mask options: table 10-1. selecting mask option of pin pin mask option p40-p43 pull-up resistor can be connected in 1-bit units. p50-p53 p40 through p43 (port 4) or p50 through p53 (port 5) can be connected with pull-up resistors by mask option. the mask option can be specified in 1-bit units. if the pull-up resistor is connected by mask option, port 4 or 5 goes high on reset. if the pull-up resistor is not connected, the port goes into a high-impedance state on reset. pull-up resistors, specified with the mask option, are not connected to the m pd75p0116. 10.2 mask option of standby function the standby function of the m pd750108 allows you to select wait time by using a mask option. the wait time is required for the cpu to return to the normal operation mode after stop mode has been released by an interrupt (for details, see section 7.2 ). the wait time can be set to either of the following: <1> 2 9 /f cc (256 m s at 2 mhz, 512 m s at 1 mhz) <2> no wait the m pd75p0116 does not have a mask option and its wait time is fixed to 2 9 /f cc . 10
240 m pd750108 user's manual 10.3 mask option for feedback resistor of subsystem clock for the subsystem clock of the m pd750108, whether to enable the feedback resistor is selected by the mask option. <1> enable the feedback resistor (switches on or off by software). <2> disable the feedback resistor (cuts by hardware). to use the feedback resistor after selecting <1> , turn the feedback resistor on by setting sos.0 to 0 (for details, see (6) in section 5.2.2 ). select <1> to use the subsystem clock. for the m pd75p0116, the mask option need not be set; use of the feedback resistor is factory-set.
241 chapter 11 instruction set chapter 11 instruction set the instruction set of the m pd750108 is an improved and extended version of the 75x series instruction set. this instruction set takes over the instruction set of the 75x series, having the following features: (1) bit manipulation instructions allowing a wide variety of applications (2) efficient 4-bit manipulation instructions (3) eight-bit instructions comparable to 8-bit microcontrollers (4) geti instruction for reducing program sizes (5) string-effect instructions and number system conversion instructions for increased program efficiency (6) table reference instructions suitable for successive references (7) 1-byte relative branch instructions (8) nec standard mnemonics designed for clarity and readability see section 3.2 for the addressing modes applicable to data memory manipulation and register banks used for instruction execution. 11.1 unique instructions this section outlines the unique instructions among the m pd750108 instruction set. 11.1.1 geti instruction the geti instruction converts any of the following instructions to a 1-byte instruction: (a) subroutine call instruction for the entire space (b) branch instruction for the entire space (c) arbitrary 2-byte instruction operating with two machine cycles (except the brcb and callf instructions) (d) a combination of two 1-byte instructions the geti instruction references the table located at addresses 0020h to 007fh in program memory, and executes referenced 2-byte data as an instruction of (a), (b), (c), or (d) above. this means that 48 instructions consisting of (a) to (d) can be converted to 1-byte instructions. thus the geti instruction can be used to convert frequently used instructions of (a) to (d) to 1-byte instructions to reduce the number of program bytes significantly. 11
242 m pd750108 user's manual 11.1.2 bit manipulation instruction the m pd750108 has reinforced bit test, bit transfer, and bit boolean (and, or, and xor) instruction, in addition to the ordinary bit manipulation (set and clear) instructions. the bit to be manipulated is specified in the bit manipulation addressing mode. three types of bit manipulation addressing modes can be used. the bits manipulated in each addressing mode are shown in table 11-1. table 11-1. types of bit manipulation addressing modes and specification range addressing peripheral hardware that can be addressing range of bit that can be manipulated manipulated fmem. bit rbe, mbe, ist1, ist0, scc, fb0h-fbfh iexxx, irqxxx port0-8 ff0h-fffh pmem. @l bsb0-3, port0-8 fc0h-fffh @h+mem. bit all peripheral hardware units that can be all bits of memory bank specified by mb manipulated bitwise that can be manipulated bitwise remarks 1. xxx: 0, 1, 2, 4, bt, t0, t1, w, csi 2. mb = mbe ? mbs 11.1.3 string-effect instructions with the m pd750108, two types of string-effect instructions are available. (a) mov a,#n4 or mov xa,#n8 (b) mov hl,#n8 "string effect" means the locating of these two types of instructions at contiguous addresses. example a0: mov a,#0 a1: mov a,#1 xa7: mov xa,#07 when string-effect instructions are arranged as in this example, if execution starts at address a0, the following two instructions are replaced with an nop instruction. if execution starts at address a1, the following one instruction is replaced with an nop instruction. that is, only the instruction first executed is valid, and any following instructions are processed as an nop instruction. by using string-effect instructions, a constant can be set in an accumulator (the a register or the xa register pair) or data pointer (the hl register pair) more efficiently.
243 chapter 11 instruction set 11.1.4 number system conversion instructions an application may need to convert the result of a 4-bit data addition or subtraction (performed in binary) to a decimal number. a time-related application may require sexagesimal conversion. for this reason, the instruction set of the m pd750108 contains number system conversion instructions for converting the result of a 4-bit data addition or subtraction to a number in an arbitrary number system. (a) number system conversion for addition let m be a desired number system after conversion. the following combination of instructions adds the contents of an accumulator to data in memory (hl), then converts the result of the addition to number system m. adds a,#16 C m addc a,@hl ; a, cy 244 m pd750108 user's manual 11.1.5 skip instructions and the number of machine cycles required for a skip the instruction set of the m pd750108 is designed to organize a program by testing a condition with the skip function. when a skip instruction satisfies the skip condition, the immediately following instruction is skipped to execute the instruction immediately after the skipped instruction. a skip requires the following number of machine cycles: (a) when the instruction (to be skipped) immediately following the skip instruction is a 3-byte instruction (that is, the br !addr, bra !addr1, call !addr, or calla !addr1 instruction): 2 machine cycles (b) when the instruction (to be skipped) immediately following the skip instruction is an instruction other than the instructions described in (a) above: 1 machine cycle
245 chapter 11 instruction set 11.2 instruction set and operation (1) operand identifier and description the operand field of an instruction must contain an operand coded according to the description rule for the operand identifier of the instruction. (refer to ra75x assembler package users manual: language (eeu-1343 ) for detailed information.) when there are multiple descriptions for an identifier, one item is to be selected. the uppercase letters and + and C signs are keywords, which must be coded as they appear. for immediate data, a proper numeric value or label must be coded. the abbreviations for register flags shown in figure 3-7 can be coded as labels in place of mem, fmem, pmem, and bit. (however, not all labels can be coded for the fmem and pmem. for details, see table 3-1 and figure 3-7 ) representation format description method reg x, a, b, c, d, e, h, l reg1 x, b, c, d, e, h, l rp xa, bc, de, hl rp1 bc, de, hl rp2 bc, de rp xa, bc, de, hl, xa, bc, de, hl rp1 bc, de, hl, xa, bc, de, hl rpa hl, hl+, hlC, de, dl rpa1 de,dl n4 4-bit immediate data or label n8 8-bit immediate data or label mem 8-bit immediate data or label note bit 2-bit immediate data or label fmem fb0h-fbfh and ff0h-fffh immediate data or label pmem fc0h-fffh immediate data or label addr, 0000h-0fffh immediate data or label ( m PD750104) addr1(for mkii mode only) 0000h-17ffh immediate data or label ( m pd750106) 0000h-1fffh immediate data or label ( m pd750108) 0000h-3fffh immediate data or label ( m pd75p0116) caddr 12-bit immediate data or label faddr 11-bit immediate data or label taddr 20h-7fh immediate data (bit 0 = 0) or label portn port0-port8 iexxx iebt, iet0, iet1, ie0-ie2, ie4, iecsi, iew rbn rb0-rb3 mbn mb0, mb1, mb15 note for mem, only even addresses can be coded for 8-bit data processing.
246 m pd750108 user's manual (2) legend a: a register; 4-bit accumulator b: b register c: c register d: d register e: e register h: h register l: l register x: x register xa: register pair (xa), 8-bit accumulator bc: register pair (bc) de: register pair (de) hl: register pair (hl) xa: extended register pair (xa) bc: extended register pair (bc) de: extended register pair (de) hl: extended register pair (hl) pc: program counter sp: stack pointer cy: carry flag, bit accumulator psw: program status word mbe: memory bank enable flag rbe: register bank enable flag portn: port n (n = 0 to 8) ime: interrupt master enable flag ips: interrupt priority specification register iexxx: interrupt enable flag rbs: register bank select register mbs: memory bank select register pcc: processor clock control register .: address/bit delimiter (xx): contents addressed by xx xxh: hexadecimal data
247 chapter 11 instruction set (3) explanation of symbols used for the addressing area column remarks 1. mb represents an accessible memory bank. 2. for * 2, mb = 0 regardless of the setting of mbe and mbs. 3. for * 4 and * 5, mb = 15 regardless of the setting of mbe and mbs. 4. each of * 6 to * 11 indicates an addressable area. * 1 mb = mbe mbs (mbs = 0, 1, 15) * 2 mb = 0 * 3 mbe = 0 : mb = 0 * 4 mb = 15, fmem = fb0h - fbfh, * 5 mb = 15, pmem = fc0h - fffh * 6 addr, addr1 = 0000h - 0fffh * 7 addr , addr1 = (current pc) C 15 to (current pc) C 1 * 8 caddr = 0000h - 0fffh caddr = 0000h - 0fffh (pc 12 = 0) or * 9 faddr = 0000h - 07ffh * 10 taddr = 0020h - 007fh * 11 for mkii mode only addr1 = data memory addressing program memory addressing PD750104 pd750106 pd750108 pd75p0116 PD750104 pd750106 pd750108 pd75p0116 addr, addr1 = 0000h - 17ffh addr, addr1 = 0000h - 1fffh addr, addr1 = 0000h - 3fffh (000h - 07fh) (f80h - fffh) (mbs =0, 1, 15) 0000h - 0fffh ( PD750104) 0000h - 17ffh ( pd750106) 0000h - 1fffh ( pd750108) 0000h - 3fffh ( pd75p0116) 1000h - 1fffh (pc 12 = 1) 0000h - 0fffh (pc 13 , pc 12 = 00b) or 1000h - 1fffh (pc 13 , pc 12 = 01b) or 2000h - 2fffh (pc 13 , pc 12 = 10b) or 3000h - 3fffh (pc 13 , pc 12 = 11b) caddr = 1000h - 17ffh (pc 12 = 1) caddr = 0000h - 0fffh (pc 12 = 0) or (current pc) + 2 to (current pc) + 16 ff0h - fffh mb = 15 mbe = 1 : mb = mbs
248 m pd750108 user's manual (4) explanation of the machine cycle column s represents the number of machine cycles required when a skip instruction with the skip function performs a skip operation. s assumes one of the following values: ? when no skip operation is performed: s = 0 ? when a 1-byte instruction or 2-byte instruction is skipped: s = 1 ? when a 3-byte instruction note is skipped: s = 2 note 3-byte instruction: br !addr, bra !addr1, call !addr, and calla !addr1 instructions caution the geti instruction is skipped in one machine cycle. one machine cycle is equal to one cycle (t cy ) of the cpu clock ( f ), and four different machine cycles are available for selection according to the pcc setting. (see figure 5-12 .)
249 chapter 11 instruction set in- mne- number machine address- struc- monic operand of cycle operation ing skip condition tion bytes area mov a,#n4 1 1 a (hl) * 1 a,@hl+ 1 2+s a (hl), then l <- l+1 * 1 l=0 a,@hlC 1 2+s a (hl), then l <- lC1 * 1 l=fh a,@rpa1 1 1 a (rpa1) * 2 xa,@hl 2 2 xa (hl) * 1 a,mem 2 2 a (mem) * 3 xa,mem 2 2 xa (mem) * 3 a,reg1 1 1 a reg1 xa,rp 2 2 xa rp transfer
250 m pd750108 user's manual in- mne- number machine address- struc- monic operand of cycle operation ing skip condition tion bytes area movt xa,@pcde 1 3 ? m PD750104 xa PD750104 xa PD750104. only the lsb is valid in register b in the m pd750106 and m pd750108. only the low-order two bits are valid in the m pd75p0116. arithmetic/logical table reference bit transfer
251 chapter 11 instruction set in- mne- number machine address- struc- monic operand of cycle operation ing skip condition tion bytes area and a,#n4 2 2 a 252 m pd750108 user's manual in- mne- number machine address- struc- monic operand of cycle operation ing skip condition tion bytes area set1 mem.bit 2 2 (mem.bit) 253 chapter 11 instruction set branch in- mne- number machine address- struc- monic operand of cycle operation ing skip condition tion bytes area br addr ? m PD750104 * 6 pc 11-0 PD750104 * 11 pc 11-0 254 m pd750108 user's manual branch notes 1. set register b to 0. 2. only the lsb is valid in register b. 3. only the low-order two bits are valid in register b. in- mne- number machine address- struc- monic operand of cycle operation ing skip condition tion bytes area br !addr 3 3 ? m PD750104 * 6 pc 11-0 PD750104 * 7 pc 11-0 PD750104 * 7 pc 11-0 PD750104 pc 11-0 PD750104 pc 11-0 PD750104 * 11 pc 11-0 255 chapter 11 instruction set in- mne- number machine address- struc- monic operand of cycle operation ing skip condition tion bytes area br bcxa 2 3 ? m PD750104 * 11 pc 11-0 PD750104 * 11 pc 11-0 PD750104 * 8 pc 11-0 PD750104 * 11 (spC2) 256 m pd750108 user's manual in- mne- number machine address- struc- monic operand of cycle operation ing skip condition tion bytes area call note !addr 3 3 ? m PD750104 * 6 (spC3) PD750104 (spC2) PD750104 * 9 (spC3) 257 chapter 11 instruction set in- mne- number machine address- struc- monic operand of cycle operation ing skip condition tion bytes area callf note !faddr 2 3 ? m PD750104 * 9 (spC2) C> x, x, mbe,rbe (spC6)(spC3)(spC4) x, x, mbe,rbe (spC6)(spC3)(spC4) PD750104 pc 11-0 PD750104 x, x, mbe, rbe 258 m pd750108 user's manual subroutine stack control in- mne- number machine address- struc- monic operand of cycle operation ing skip condition tion bytes area rets note 1 3+s ? m PD750104 unconditionally mbe, rbe, 0, 0 PD750104 0, 0, 0, 0 PD750104 mbe, rbe, 0, 0 259 chapter 11 instruction set in- mne- number machine address- struc- monic operand of cycle operation ing skip condition tion bytes area reti note 1 13? m PD750104 0, 0, 0, 0 260 m pd750108 user's manual special in- mne- number machine address- struc- monic operand of cycle operation ing skip condition tion bytes area sel rbn 2 2 rbs PD750104 * 10 when the tbr instruction is used pc 11-0 261 chapter 11 instruction set special in- mne- number machine address- struc- monic operand of cycle operation ing skip condition tion bytes area geti notes1, 2 taddr 1 3 ? m PD750104 * 10 when the tbr instruction is used pc 11-0 262 m pd750108 user's manual 11.3 instruction codes of each instruction (1) explanations of the symbols for the instruction codes i n : immediate data for n4 or n8 d n : immediate data for mem b n : immediate data for bit n n : immediate data for n or iexxx t n : immediate data for taddr x 1/2 a n : immediate data for the address (2 to 16) relative to branch destination address minus one s n : immediate data for the ones complement of the address (15 to 1) relative to the branch destination address reg r 2 r 1 r 0 reg 000 a 001 x 010 l 011 h 100 e 101 d 110 c 111 b reg1 rp' p 2 p 1 p 0 reg-pair 000 xa 0 0 1 xa' 010 hl 0 1 1 hl' 100 de 1 0 1 de' 110 bc 1 1 1 bc' rp'1 q 2 q 1 q 0 addressing 0 0 0 @hl 0 1 0 @hl+ 0 1 1 @hlC 1 0 0 @de 1 0 1 @dl @rpa rp2 p 2 p 1 reg-pair 00 xa 01 hl 10 de 11 bc rp1 rp n 5 n 2 n 1 000 001 110 010 010 011 011 100 n 0 0 0 0 0 1 0 1 0 iexxx iebt iew iet1 iet0 iecsi ie0 ie2 ie4 1 1 1 0 ie1 @rpa1
263 chapter 11 instruction set (2) bit manipulation addressing instruction codes * 1 in the operand field indicates that there are three types of bit manipulation addressing, fmem.bit, pmem.@l, and @h+mem.bit. the table below lists the second byte * 2 of an instruction code corresponding to the above addressing. * 1 second byte of instruction code accessible bits fmem.bit 1 0 b 1 b 0 f 3 f 2 f 1 f 0 fb0h-fbfh manipulatable bits 11b 1 b 0 f 3 f 2 f 1 f 0 ff0h-fffh manipulatable bits pmem.@l 0 1 0 0 g 3 g 2 g 1 g 0 fc0h-fffh manipulatable bits @h+mem.bit 0 0 b 1 b 0 d 3 d 2 d 1 d 0 manipulatable bits of accessible memory bank b n : immediate data for bit f n : immediate data for fmem (low-order four bits of address) g n : immediate data for pmem (bits 2 to 5 of address) d n : immediate data for mem (low-order four bits of address)
264 m pd750108 user's manual instruction mne- operand instruction code monic b 1 b 2 b 3 transfer mov a,#n4 0111i 3 i 2 i 1 i 0 reg1,#n4 10011010 i 3 i 2 i 1 i 0 1r 2 r 1 r 0 rp,#n8 10001p 2 p 1 1i 7 i 6 i 5 i 4 i 3 i 2 i 1 i 0 a,@rpa1 11100q 2 q 1 q 0 xa,@hl 10101010 00011000 @hl,a 11101000 @hl,xa 10101010 00010000 a,mem 10100011 d 7 d 6 d 5 d 4 d 3 d 2 d 1 d 0 xa,mem 10100010 d 7 d 6 d 5 d 4 d 3 d 2 d 1 0 mem,a 10010011 d 7 d 6 d 5 d 4 d 3 d 2 d 1 d 0 mem,xa 10010010 d 7 d 6 d 5 d 4 d 3 d 2 d 1 0 a,reg 10011001 01111r 2 r 1 r 0 xa,rp 10101010 01011p 2 p 1 p 0 reg1,a 10011001 01110r 2 r 1 r 0 rp1,xa 10101010 01010p 2 p 1 p 0 xch a,@rpa1 11101q 2 q 1 q 0 xa,@hl 10101010 00010001 a,mem 10110011 d 7 d 6 d 5 d 4 d 3 d 2 d 1 d 0 xa,mem 10110010 d 7 d 6 d 5 d 4 d 3 d 2 d 1 0 a,reg1 11011r 2 r 1 r 0 xa,rp 10101010 01000p 2 p 1 p 0 table movt xa,@pcde 11010100 reference xa,@pcxa 11010000 xa,@bcxa 11010001 xa,@bcde 11010101 bit mov1 cy, * 1 10111101 * 2 transfer * 1 ,cy 10011011 * 2
265 chapter 11 instruction set instruction mne- operand instruction code monic b 1 b 2 b 3 arithmetic/ adds a,#n4 0110i 3 i 2 i 1 i 0 logical xa,#n8 10111001 i 7 i 6 i 5 i 4 i 3 i 2 i 1 i 0 a,@hl 11010010 xa,rp 10101010 11001p 2 p 1 p 0 rp1,xa 10101010 11000p 2 p 1 p 0 addc a,@hl 10101001 xa,rp 10101010 11011p 2 p 1 p 0 rp1,xa 10101010 11010p 2 p 1 p 0 subs a,@hl 10101000 xa,rp 10101010 11101p 2 p 1 p 0 rp1,xa 10101010 11100p 2 p 1 p 0 subc a,@hl 10111000 xa,rp 10101010 11111p 2 p 1 p 0 rp1,xa 10101010 11110p 2 p 1 p 0 and a,#n4 10011001 0011i 3 i 2 i 1 i 0 a,@hl 10010000 xa,rp 10101010 10011p 2 p 1 p 0 rp1,xa 10101010 10010p 2 p 1 p 0 or a,#n4 10011001 0100i 3 i 2 i 1 i 0 a,@hl 10100000 xa,rp 10101010 10101p 2 p 1 p 0 rp1,xa 10101010 10100p 2 p 1 p 0 xor a,#n4 10011001 0101i 3 i 2 i 1 i 0 a,@hl 10110000 xa,rp 10101010 10111p 2 p 1 p 0 rp1,xa 10101010 10110p 2 p 1 p 0 accumulator rorc a 10011000 manipulation not a 10011001 01011111
266 m pd750108 user's manual instruction mne- operand instruction code monic b 1 b 2 b 3 increment/ incs reg 11000r 2 r 1 r 0 decrement rp1 10001p 2 p 1 0 @hl 10011001 00000010 mem 10000010 d 7 d 6 d 5 d 4 d 3 d 2 d 1 d 0 decs reg 11001r 2 r 1 r 0 rp 10101010 01101p 2 p 1 p 0 comparison ske reg,#n4 10011010 i 3 i 2 i 1 i 0 0r 2 r 1 r 0 @hl,#n4 10011001 0110i 3 i 2 i 1 i 0 a,@hl 10000000 xa,@hl 10101010 00011001 a,reg 10011001 00001r 2 r 1 r 0 xa,rp 10101010 01001p 2 p 1 p 0 carry flag set1 cy 11100111 manipu- clr1 cy 11100110 lation skt cy 11010111 not1 cy 11010110 memory set1 mem.bit 1 0 b 1 b 0 0101 d 7 d 6 d 5 d 4 d 3 d 2 d 1 d 0 bit * 1 10011101 * 2 manipu- clr1 mem.bit 1 0 b 1 b 0 0100 d 7 d 6 d 5 d 4 d 3 d 2 d 1 d 0 lation * 1 10011100 * 2 skt mem.bit 1 0 b 1 b 0 0111 d 7 d 6 d 5 d 4 d 3 d 2 d 1 d 0 * 1 10111111 * 2 skf mem.bit 1 0 b 1 b 0 0110 d 7 d 6 d 5 d 4 d 3 d 2 d 1 d 0 * 1 10111110 * 2 sktclr * 1 10011111 * 2 and1 cy, * 1 10101100 * 2 or1 cy, * 1 10101110 * 2 xor1 cy, * 1 10111100 * 2
267 chapter 11 instruction set instruction mne- operand instruction code monic b 1 b 2 b 3 branch br !addr 10101011 00 addr $addr1 0000a 3 a 2 a 1 a 0 (+16) to (+2) (C1) to (C15) 1111s 3 s 2 s 1 s 0 pcde 10011001 00000100 pcxa 10011001 00000000 bcde 00000101 bcxa 10011001 00000001 bra !addr1 10111010 0 addr1 brcb !caddr 0101 caddr sub- call !addr 10101011 01 addr routine calla !addr1 10111011 0 addr1 stack callf !faddr 01000 faddr control ret 11101110 rets 11100000 reti 11101111 push rp 01001p 2 p 1 1 bs 10011001 00000111 pop rp 01001p 2 p 1 0 bs 10011001 00000110 i/o in a,portn 10100011 1111n 3 n 2 n 1 n 0 xa,portn 10100010 1111n 3 n 2 n 1 n 0 out portn,a 10010011 1111n 3 n 2 n 1 n 0 portn,xa 10010010 1111n 3 n 2 n 1 n 0 interrupt ei 10011101 10110010 control iexxx 10011101 10n 5 11n 2 n 1 n 0 di 10011100 10110010 iexxx 10011100 10n 5 11n 2 n 1 n 0 cpu halt 10011101 10100011 control stop 10011101 10110011 nop 01100000 special sel rbn 10011001 001000n 1 n 0 mbn 10011001 0001n 3 n 2 n 1 n 0 geti taddr 0 0 t 5 t 4 t 3 t 2 t 1 t 0
268 m pd750108 user's manual 11.4 functions and applications of the instructions this section explains functions and applications of the instructions. for the m PD750104, m pd750106, m pd750108, and m pd75p0116, usable instructions and their functions in mk i mode are different from those in mk ii mode. read the following explanation. how to read can be used in both mk i mode and mk ii mode for the m PD750104, m pd750106, m pd750108, and m pd75p0116 i can be used in only mk i mode for the m PD750104, m pd750106, m pd750108, and m pd75p0116 ii can be used in only mk ii mode for the m PD750104, m pd750106, m pd750108, and m pd75p0116 i/ii can be used in both mk i mode and mk ii mode for the m PD750104, m pd750106, m pd750108, and m pd75p0116. however, mk i mode is different from mk ii mode in the functions. read the explanation of [mk i mode] for mk i mode and the explanation of [mk ii mode] for mk ii mode, as required. remark " function " in this section is applicable to the m pd750106 and m pd750108 whose program counters consist of 13 bits each. this is also applicable to the m PD750104 whose program counter consists of 12 bits and the m pd75p0116 whose program counter consists of 14 bits, however. 11.4.1 transfer instructions mov a,#n4 function: a 269 chapter 11 instruction set mov reg1,#n4 function: reg1 270 m pd750108 user's manual then skips the immediately following instruction. when hlC (automatic decrement) is specified for the register pair, automatically decrements the contents of the l register by one after the data transfer, and continues the operation until the contents are set to fh. then skips the immediately following instruction. mov xa,@hl function: a 271 chapter 11 instruction set mov xa,mem function: a 272 m pd750108 user's manual mov reg1,a function: reg1 (register pair specified by the operand) when hl+ is specified for the register pair: skip if l = 0 when hlC is specified for the register pair: skip if l = fh exchanges the contents of the a register with the data at the data memory location addressed by the specified register pair (hl, hl+, hlC , de, dl). when hl+ (automatic increment) is specified for the register pair, automatically increments the contents of the l register by one after the data exchange, and continues the operation until the contents are set to 0. then skips the immediately following instruction. when hlC (automatic decrement) is specified for the register pair, automatically decrements the contents of the l register by one after the data exchange, and continues the operation until the contents are set to fh. then skips the immediately following instruction. example the data at addresses 20h-2fh are exchanged with the data at addresses 30h-3fh. sel mb0 mov d,#2 mov hl,#30h loop: xch a,@hl ; a (3x) xch a,@dl ; a (2x) xch a,@hl+ ; a (3x) br loop
273 chapter 11 instruction set xch xa,@hl function: a (hl), x (hl+1) exchanges the contents of the a register with the data at the data memory location addressed by the hl register pair, and exchanges the contents of the x register with the data at the next memory address. however, if the contents of the l register are odd- numbered, an address with the low-order bit ignored is specified. xch a,mem function: a (mem) mem = d 7-0 : 00h-feh exchanges the contents of the a register with the data at the data memory location addressed by the 8- bit immediate data mem. xch xa,mem function: a (mem), x (mem+1) mem = d 7-0 : 00h-feh exchanges the contents of the a register with the data at the data memory location addressed by the 8- bit immediate data mem, and exchanges the contents of the x register 1 with the data at the next memory address. an even address can be specified with mem. xch a,reg1 function: a reg1 exchanges the contents of the a register with register reg1 (x, h, l, d, e, b, c). xch xa,rp function: xa rp exchanges the contents of the xa register pair with the contents of register pair rp (xa, hl, de, bc, xa, hl, de, bc).
274 m pd750108 user's manual 11.4.2 table reference instructions movt xa,@pcde function: for the m pd750106 and m pd750108 xa PD750104 whose program counter consists of 12 bits and the m pd75p0116 whose program counter consists of 14 bits, however. caution the movt xa,@pcde instruction usually references table data in the page containing that instruction. however, when the instruction is located at address xxffh, table data in the next page is referenced instead of table data in the page containing that instruction. pc 12-8 d 3-0 e 3-0 8 7 4 3 0 12 table address table data h table data l x 30 a 30 4 3 70 program memory 70 program memory page 2 page 3 a 02ffh 0300h
275 chapter 11 instruction set for example, if movt xa,@pcde is located at a as shown above, the table data in page 3 specified by the contents of the de register pair is transferred to the xa register pair instead of that in page 2. example the 16-byte data at addresses xxf0h-xxffh in program memory is transferred to addresses 30h-4fh in data memory. sub: sel mb0 mov hl,#30h ; hl PD750104 whose program counter consists of 12 bits and the m pd75p0116 whose program counter consists of 14 bits, however.
276 m pd750108 user's manual movt xa,@bcxa function: for the m pd750106 and m pd750108 xa PD750104 whose program counter consists of 12 bits and the m pd75p0116 whose program counter consists of 14 bits, however. 11 12 8 7 4 3 0 b 0 cxa table data h table data l x 30 a 30 11 12 8 7 4 3 0 b 0 cde table data h table data l x 30 a 30
277 chapter 11 instruction set 11.4.3 bit transfer instructions mov1 cy,fmem.bit mov1 cy,pmem.@l mov1 cy,@h+mem.bit function: cy 278 m pd750108 user's manual adds xa,#n8 function: xa 279 chapter 11 instruction set addc xa,rp function: xa, cy 280 m pd750108 user's manual subs rp1,xa function: rp1 281 chapter 11 instruction set and a,@hl function: a 282 m pd750108 user's manual or rp1,xa function: rp1 283 chapter 11 instruction set 11.4.5 accumulator manipulation instructions rorc a function: cy <- a 0 , a n-1 <- a n , a 3 <- cy (n = 1-3) rotates the contents of the a register (4-bit accumulator) through the carry flag one bit position to the right. not a function: a 284 m pd750108 user's manual incs mem function: (mem) 285 chapter 11 instruction set ske xa,@hl function: skip if a = (hl) and x = (hl+1) skips the immediately following instruction if the contents of the a register match the data at the data memory location addressed by the hl register pair, and the contents of the x register match the data at the next address in data memory. however, if the contents of the l register are odd- numbered, an address with the lowest-order bit ignored is specified. ske a,reg function: skip if a = reg skips the immediately following instruction if the contents of the a register match the contents of register reg (x, a, h, l, d, e, b, c). ske xa,rp function: skip if xa = rp skips the immediately following instruction if the contents of the xa register pair match the contents of register pair rp (xa, hl, de, bc, xa, hl, de, bc). 11.4.8 carry flag manipulation instructions set1 cy function: cy 286 m pd750108 user's manual not1 cy function: cy 287 chapter 11 instruction set skt mem.bit function: skip if (mem.bit) = 1 mem = d 7-0 : 00h-ffh, bit = b 1-0 : 0-3 skips the immediately following instruction if the bit specified by the 2-bit immediate data bit at the address specified by the 8-bit immediate data mem is 1. skt fmem.bit skt pmem.@l skt @h+mem.bit function: skip if (bit specified in operand) = 1 skips the immediately following instruction if the bit in data memory specified by bit manipulation addressing (fmem.bit, pmem.@l, @h+mem.bit) is set to 1. skf mem.bit function: skip if (mem.bit) = 0 mem = d 7-0 : 00h-ffh, bit = b 1-0 : 0-3 skips the immediately following instruction if the bit specified by the 2-bit immediate data bit at the address specified by the 8-bit immediate data mem is 0. skf fmem.bit skf pmem.@l skf @h+mem.bit function: skip if (bit specified in operand) = 0 skips the immediately following instruction if the bit in data memory specified by bit manipulation addressing (fmem.bit, pmem.@l, @h+mem.bit) is 0. sktclr fmem.bit sktclr pmem.@l sktclr @h+mem.bit function: skip if (bit specified in operand) = 1 then clear skips the immediately following instruction if the bit in data memory specified by bit manipulation addressing (fmem.bit, pmem.@l, @h+mem.bit) is 1, then clears the bit to 0.
288 m pd750108 user's manual and1 cy,fmem.bit and1 cy,pmem.@l and1 cy,@h+mem.bit function: cy 289 chapter 11 instruction set br addr1 function: for the m pd750108 pc 12-0 PD750104 whose program counter consists of 12 bits (addr = 0000h to 0fffh), the m pd750106 whose program counter consists of 13 bits (addr = 0000h to 17ffh), and the m pd75p0116 whose program counter consists of 14 bits (addr = 0000h to 3fffh). bra !addr1 function: for the m pd750108 pc 12-0 290 m pd750108 user's manual remark " function " in this section is applicable to the m pd750108 whose program counter consists of 13 bits (addr = 0000h to 1fffh). however, this is also applicable to the m PD750104 whose program counter consists of 12 bits (addr = 0000h to 0fffh), the m pd750106 whose program counter consists of 13 bits (addr = 0000h to 17ffh), and the m pd75p0116 whose program counter consists of 14 bits (addr = 0000h to 3fffh). brcb !caddr function: for the m pd750108 pc 12-0 PD750104 consists of 11 bits, this instruction enables a branch to any location in the program memory space. in the m pd750106 and m pd750108, pc 12 cannot be changed, so no branch occurs beyond the block. similarly, in the m pd75p0116, pc 12 and pc 13 cannot be changed, so no branch occurs beyond the block. caution the brcb !caddr instruction usually causes a branch within the block containing the instruction. however, if the first byte is located at address 0ffeh or 0fffh, a branch to block 1 instead of block 0 occurs. if the brcb !caddr instruction is located at a or b in the figure above, a branch to block 1 instead of block 0 occurs. remark " function " in this section is applicable to the m pd750108 whose program counter consists of 13 bits (addr = 0000h to 1fffh). however, this is also applicable to the m PD750104 whose program counter consists of 12 bits (addr = 0000h to 0fffh), the m pd750106 whose program counter consists of 13 bits (addr = 0000h to 17ffh), and the m pd75p0116 whose program counter consists of 14 bits (addr = 0000h to 3fffh). a b 70 program memory 0ffeh 0fffh 1000h block 0 block 1
291 chapter 11 instruction set br pcde function: for the m pd750108 pc 12-0 PD750104 whose program counter consists of 12 bits (addr = 0000h to 0fffh), the m pd750106 whose program counter consists of 13 bits (addr = 0000h to 17ffh), and the m pd75p0116 whose program counter consists of 14 bits (addr = 0000h to 3fffh). 70 program memory 02feh 02ffh 0300h page 2 page 3 a b
292 m pd750108 user's manual br bcde function: for the m pd750108 pc 12-0 PD750104 whose program counter consists of 12 bits (addr = 0000h to 0fffh), the m pd750106 whose program counter consists of 13 bits (addr = 0000h to 17ffh), and the m pd75p0116 whose program counter consists of 14 bits (addr = 0000h to 3fffh). b c 30 0 d 30 e 30 11 8 7 4 3 0 12 pc b c 30 0 x 30 a 30 11 8 7 4 3 0 12 pc
293 chapter 11 instruction set 11.4.11 subroutine stack control instructions calla !addr1 function: for the m pd750108 (spC2) PD750104 whose program counter consists of 12 bits (addr = 0000h to 0fffh), the m pd750106 whose program counter consists of 13 bits (addr = 0000h to 17ffh), and the m pd75p0116 whose program counter consists of 14 bits (addr = 0000h to 3fffh). i/ii ii
294 m pd750108 user's manual callf !faddr function: for the m pd750108 [mk i mode] (spC1) PD750104 whose program counter consists of 12 bits (addr = 0000h to 0fffh), the m pd750106 whose program counter consists of 13 bits (addr = 0000h to 17ffh), and the m pd75p0116 whose program counter consists of 14 bits (addr = 0000h to 3fffh). i/ii
295 chapter 11 instruction set ret function: for the m pd750108 [mk i mode] pc 11-8 PD750104 whose program counter consists of 12 bits (addr = 0000h to 0fffh), the m pd750106 whose program counter consists of 13 bits (addr = 0000h to 17ffh), and the m pd75p0116 whose program counter consists of 14 bits (addr = 0000h to 3fffh). rets function: for the m pd750108 [mk i mode] pc 11-8 296 m pd750108 user's manual remark " function " in this section is applicable to the m pd750108 whose program counter consists of 13 bits (addr = 0000h to 1fffh). however, this is also applicable to the m PD750104 whose program counter consists of 12 bits (addr = 0000h to 0fffh), the m pd750106 whose program counter consists of 13 bits (addr = 0000h to 17ffh), and the m pd75p0116 whose program counter consists of 14 bits (addr = 0000h to 3fffh). reti function: for the m pd750108 [mk i mode] pc 11-8 PD750104 whose program counter consists of 12 bits (addr = 0000h to 0fffh), the m pd750106 whose program counter consists of 13 bits (addr = 0000h to 17ffh), and the m pd75p0116 whose program counter consists of 14 bits (addr = 0000h to 3fffh). push rp function: (spC1) 297 chapter 11 instruction set push bs function: (spC1) 298 m pd750108 user's manual di iexxx function: iexxx 299 chapter 11 instruction set caution before this instruction can be executed, mbe = 0 or (mbe = 1, mbs = 15) must be set. only 4 or 6 can be specified as n. 11.4.14 cpu control instructions halt function: pcc.2 300 m pd750108 user's manual geti taddr function: taddr = t 5-0 , 0 : 20h-7fh for the m pd750108 [mk i mode] ? when a table defined by the tbr instruction is referenced pc 12-0 PD750104 whose program counter consists of 12 bits (addr = 0000h to 0fffh), the m pd750106 whose program counter consists of 13 bits (addr = 0000h to 17ffh), and the m pd75p0116 whose program counter consists of 14 bits (addr = 0000h to 3fffh). the 2-byte data at the program memory addresses specified by (taddr) and (taddr+1) is referenced and executed as an instruction. addresses 0020h to 007fh are used as a reference table area. data must be written to this area beforehand. when a 1-byte instruction or 2-byte instruction is written, its mnemonic can be used directly. for a 3-byte call instruction or 3-byte branch instruction, an assembler pseudo instruction (tcall, tbr) is used. only an even address can be specified as taddr. i/ii
301 chapter 11 instruction set caution all 2-byte instructions (except the brcb instruction and callf instruction) set in the reference table must be 2-machine-cycle instructions. pairs of 1-byte instructions can be set as indicated in the table below. first byte instruction second byte instruction incs l mov a,@hl decs l mov @hl,a incs h xch a,@hl decs h incs hl incs e mov a,@de decs e incs d xch a,@de decs d incs de mov a,@dl incs l decs l xch a,@dl incs d decs d the pc is not incremented during execution of a geti instruction, so that after a reference instruction is executed, execution is resumed starting at the address immediately after the geti instruction. if the instruction immediately preceding a geti instruction has the skip function, the geti instruction is skipped as with other 1-byte instructions. if an instruction referenced with a geti instruction has the skip function, the instruction immediately following the geti instruction is skipped. if a geti instruction references an instruction having a string effect, the following processing is performed: ? if the instruction immediately preceding the geti instruction also has the string effect in the same group, the execution of the geti instruction cancels the string effect, and the referenced instruction is not skipped. ? if the instruction immediately following the geti instruction also has the string effect of the same group, the string effect of the referenced instruction remains valid, and the next instruction is skipped.
302 m pd750108 user's manual example mov hl, #00h mov xa, #ffh are replaced with geti instructions. call sub1 br sub2 org 20h hl00: mov hl, #00h xaff: mov xa, #ffh csub1: tcall sub1 bsub2: tbr sub2 get hl00 ; mov hl,#00h geti bsub2 ; br sub2 geti csub1 ; call sub1 geti xaff ; mov xa,#ffh
303 a appendix a functions of the m pd750008, m pd750108, and m pd75p0116 pin connection instruction execution time (1/2) item m pd750008 m pd750108 m pd75p0116 program memory masked rom one-time prom 0000h - 1fffh 0000h - 3fffh (8192 x 8 bits) (16384 x 8 bits) data memory 000h - 1ffh (512 x 4 bits) cpu 75xl cpu general-purpose register (4 bits x 8 or 8 bits x 4) x 4 banks main system clock oscillator crystal/ceramic rc oscillator (with external resistor and oscillator capacitor) time required for start after reset 2 17 /f x , 2 15 /f x fixed to 56/f cc (selected using a mask option) wait time applied when stop 2 20 /f x , 2 17 /f x , 2 15 /f x, 2 9 /f cc or no wait fixed to 2 9 /f cc mode is released by an interrupt 2 13 /f x (selected accord- (selected using a mask ing to btm setting) option) subsystem clock oscillator crystal oscillator when selecting the main 0.95, 1.91, 3.81, 15.3 4, 8, 16, 64 m s (when operating at 1 mhz) system clock m s (when operating at 4.19 mhz) 2, 4, 8, 32 m s (when operating at 2 mhz) 0.67, 1.33, 2.57 10.7 m s (when operating at 6.0 mhz) when selecting the 122 m s (when operating at 32.768 khz) subsystem clock 20 (cu) ic v pp 38 (gb) 24 (cu) p21/pto1 42 (gb) 6-9 (cu) p33 - p30 p33/md3 - p30/md0 23-26 (gb) 38-41 (cu) p43 - p40 p43/d3 - p40/d0 13-16 (gb) 34-37 (cu) p53 - p50 p53/d7 - p50/d4 8-11 (gb)
304 m pd750108 user's manual (2/2) i/o port item m pd750008 m pd750108 m pd75p0116 cmos input 8 (built-in pull-up resistors that can be connected by software: 7) cmos i/o 18 (built-in pull-up resistors that can be connected by software) n-ch open-drain i/o 8 (pull-up resistors that can be incorporated by 8 (no mask option) mask option) withstand voltage of withstand voltage of 13 v 13 v total 34 timer 4 channels 4 channels 8-bit timer counter: 1 8-bit timer counter (clock timer output function 8-bit timer/event provided): 1 counter: 1 8-bit timer/event counter: 1 basic interval timer/ basic interval timer/watchdog timer: 1 watchdog timer: 1 clock timer: 1 clock timer: 1 serial interface 3 modes supported three-wire serial i/o mode: first transferred bit switchable between lsb and msb two-wire serial i/o mode sbi mode clock output (pcl) f , 524, 262, 65.5 khz f , 125, 62.5, 15.6 khz (when the main system (when the main system clock operates at 1 mhz) clock operates at 4.19 mhz) f , 750, 375, 93.8 khz f , 250, 125, 31.3 khz (when the main system (when the main system clock operates at 2 mhz) clock operates at 6.0 mhz) buzzer output (buz) 2, 4, 32 khz (when the 2, 4, 32 khz (when the subsystem clock main system clock operates at 32.768 khz) operates at 4.19 mhz 0.488, 0.977, 7.813 khz (when the main or the subsystem clock system clock operates at 1 mhz) operates at 32.768 khz) 0.977, 1.953, 15.625 khz (when the main 2.93, 5.86, 46.9 khz system clock operates at 2 mhz) (when the main system clock operates at 6.0 mhz) vectored interrupt external: 3, internal: 4 test input external: 1, internal: 1 supply voltage v dd = 2.2 to 5.5 v v dd = 1.8 to 5.5 v operating ambient temperature t a = -40 to +85 c package 42-pin plastic shrink dip (600 mil) 44-pin plastic qfp (10 x 10 mm)
305 appendix b development tools the following development tools are provided for the development of a system which employs the m pd750108. in the 75xl series, use the common relocatable assembler together with a device file of each model. note these software products cannot use the task swap function, which is available in ms-dos ver. 5.00 or later. remark the operations of the assembler and device file are guaranteed only on the above host machines and oss. ra75x relocatable assembler host machine pc-9800 series ibm pc/at tm and compatibles distribution media 3.5-inch 2hd 5.25-inch 2hd 3.5-inch 2hc 5.25-inch 2hc part number m s5a13ra75x m s5a10ra75x m s7b13ra75x m s7b10ra75x os ms-dos ver. 3.30 to ver. 6.2 note see " os for ibm pc ." device file host machine pc-9800 series ibm pc/at and compatibles distribution media 3.5-inch 2hd 5.25-inch 2hd 3.5-inch 2hc 5.25-inch 2hc part number m s5a13df750008 m s5a10df750008 m s7b13df750008 m s7b10df750008 os ms-dos ver. 3.30 to ver. 6.2 note see " os for ibm pc ." b
306 m pd750108 user's manual prom programming tools note these software products cannot use the task swap function, which is available in ms-dos ver. 5.00 or later. remark operation of the pg-1500 controller is guaranteed only on the above host machines and oss. the pg-1500 prom programmer is used together with an accessory board and optional program adapter. it allows the user to program a single chip microcomputer containing prom from a standalone terminal or a host machine. the pg-1500 can be used to program typical 256k-bit to 4m-bit proms. the pa-75p008cu is a prom programmer adapter provided for the m pd75p0116cu/gb. it is used in conjunction with the pg-1500. this program enables the host machine to control the pg-1500 through the serial and parallel interfaces. hardware software pg-1500 pa-75p008cu pg-1500 controller distribution media 3.5-inch 2hd 5.25-inch 2hd 3.5-inch 2hd 5.25-inch 2hc os ms-dos ver. 3.30 to ver. 6.2 note see " os for ibm pc ." part number m s5a13pg1500 m s5a10pg1500 m s7b13pg1500 m s7b10pg1500 host machine pc-9800 series ibm pc/at and compatibles
307 appendix b development tools the ie-75000-r is an in-circuit emulator used to debug hardware and software when developing an application system using the 75x series and 75xl series. use this emulator together with optional emulation board ie-75300-r-em and emulation probe to develop application systems of the m pd750108 subseries. for efficient debugging, connect the emulator to the host machine and a prom programmer. the ie-75000-r contains emulation board ie-75000-r-em. the board is connected to the ie-75000-r. the ie-75001-r is an in-circuit emulator used to debug hardware and software when developing an application system using the 75x series and 75xl series. use this emulator together with optional emulation board ie-75300-r-em and emulation probe. for efficient debugging, connect the emulator to the host machine and a prom programmer. the ie-75300-r-em is an emulation board used to evaluate an application system using the m pd750108 subseries. use this board together with the ie-75000-r or ie-75001-r. the ep-75008gb-r is an emulation probe for the m pd750108gb. connect this emulation probe to the ie-75000-r or ie-75001-r, and the ie- 75300-r-em. a 44-pin conversion socket, the ev-9200g-44, supplied with this probe facili- tates the connection of the probe to the target system. the ep-75008cu-r is an emulation probe for the m pd750108cu. connect this emulation probe to the ie-75000-r or ie-75001-r, and the ie- 75300-r-em. this program enables the host machine to control the ie-75000-r or ie-75001- r through the rs-232-c and centronics interface. hardware debugging tools the in-circuit emulators (ie-75000-r and ie-75001-r) are provided to debug programs used for the m pd750108. the following system is shown below. notes 1. maintenance service only 2. these software products cannot use the task swap function, which is available in ms dos ver. 5.00 or later. remarks 1. operation of the ie control program is guaranteed only on the above host machines and oss. 2. the m PD750104, m pd750106, m pd750108, and m pd75p0116 are collectively referred to as the m pd750108 subseries. see os for ibm pc . 3.5-inch 2hd 5.25-inch 2hd m s5a13ie75x m s5a10ie75x distribution media part number host machine ibm pc/at and compatibles 3.5-inch 2hc 5.25-inch 2hc m s7b13ie75x m s7b10ie75x os ms-dos ver. 3.30 to ver. 6.2 note 2 pc-9800 series ie-75000-r note 1 ie-75001-r ie-75300-r-em ep-75008gb-r ev-9200g-44 ep-75008cu-r ie control program software
308 m pd750108 user's manual os for ibm pc the following ibm pc oss are supported. os version pc dos ver. 5.02 to ver. 6.3 j6.1/v note to j6.3/v note ms-dos ver. 5.0 to ver. 6.22 5.0/v note to 6.2/v note ibm dos tm j5.02/v note note only english version is supported. caution these software products cannot use the task swap function, which is available in ms-dos ver. 5.00 or later.
309 appendix b development tools target system note 2 emulation probe ep-75008cu-r ep-75008gb-r in-circuit emulator ie-75000-r or ie-75001-r emulation board ie-75300-r-em note 1 product containing prom pd75p0116cu prom programmer pg-1500 + programmer adapter pa-75p008cu rs-232-c centronics interface ie control program pg-1500 controller host machine pc-9800 series ibm pc/at (symbolic debugging is possible.) pd75p0116gb the in-circuit emulators do not contain the ie-75300-r-em (to be ordered). ev-9200g-44 development tool configuration device file relocatable assembler + 2. notes 1.
310 m pd750108 user's manual drawings of the conversion socket (ev-9200g-44) and recommended pattern on boards figure b-1. drawings of the ev-9200g-44 (reference) a f d 1 e ev-9200g-44 b c m n o l k r q i h p j g ev-9200g-44-g0 item millimeters inches a b c d e f g h i j k l m o n p q r 15.0 10.3 10.3 15.0 4-c 3.0 0.8 5.0 12.0 14.7 5.0 12.0 14.7 8.0 7.8 2.0 1.35 0.35 0.1 1.5 0.591 0.406 0.406 0.591 4-c 0.118 0.031 0.197 0.472 0.579 0.197 0.472 0.579 0.315 0.307 0.079 0.053 0.014 0.059 +0.004 e0.005 f f no.1 pin index based on ev-9200g-44 (1) package drawing (in mm)
311 appendix b development tools figure b-2. recommended pattern on boards for the ev-9200g-44 (reference) caution dimensions of mount pad for ev-9200 and that for target device (qfp) may be different in some parts. for the recommended mount pad dimensions for qfp, refer to "semiconductor device mounting technology manual" (c10535e). 0.031 0.394=0.315 0.031 0.394=0.315 a f d e b g h i j c l k ev-9200g-44-p1e item millimeters inches a b c d e f g h i j k l 15.7 11.0 11.0 15.7 5.00 0.08 5.00 0.08 0.5 0.02 1.57 0.03 2.2 0.1 1.57 0.03 0.618 0.433 0.433 0.618 0.197 0.197 0.02 0.062 0.087 0.062 0.8 0.02 10=8.0 0.05 0.8 0.02 10=8.0 0.05 f f f +0.002 e0.001 +0.002 e0.002 +0.002 e0.001 +0.002 e0.002 +0.003 e0.004 +0.003 e0.004 +0.001 e0.002 f f f +0.001 e0.002 +0.004 e0.005 +0.001 e0.002 dimensions of mount pad for ev-9200 and that for target device (qfp) may be different in some parts. for the recommended mount pad dimensions for qfp, refer to "semiconductor device mounting technology manual" (c10535e). caution based on ev-9200g-44 (2) pad drawing (in mm)
312 m pd750108 user's manual [memo]
313 appendix c masked rom ordering procedure after program development is completed, the masked rom is ordered by the following procedure: <1> advance notice of an order for masked rom give advance notice of masked rom ordering to a special agent or necs sales department, otherwise the ordered products may be delivered with delay. <2> preparation of media for ordering masked rom orders can be placed on the following media types. ? uv-eprom note ? 3.5-inch ibm format floppy disk (outside japan only) ? 5.25-inch ibm format floppy disk (outside japan only) note when the uv-eprom option is selected, prepare three uv-eproms each having the same contents. record the mask option data on the mask option information sheet. <3> preparation of the required documents prepare the following documents when ordering a masked rom: ? masked rom order sheet ? masked rom order check sheet ? mask option information sheet <4> ordering send a set of the media created in <2> and the documents created in <3> to a special agent or necs sales department by the date indicated in the advance notice. c *
314 m pd750108 user's manual [memo]
315 appendix d instruction index d.1 instruction index (by function) [transfer instructions] mov a,#n4 ... 249, 268 mov reg1,#n4 ... 249, 269 mov xa,#n8 ... 249, 269 mov hl,#n8 ... 249, 269 mov rp2,#n8 ... 249, 269 mov a,@hl ... 249, 269 mov a,@hl+ ... 249, 269 mov a,@hlC ... 249, 269 mov a,@rpa1 ... 249, 269 mov xa,@hl ... 249, 270 mov @hl,a ... 249, 270 mov @hl,xa ...249, 270 mov a,mem ... 249, 270 mov xa,mem ... 249, 271 mov mem,a ... 249, 271 mov mem,xa ... 249, 271 mov a,reg ... 249, 271 mov xa,rp ... 249, 271 mov reg1,a ... 249, 272 mov rp1,xa ... 249, 272 xch a,@hl ... 249, 272 xch a,@hl+ ... 249, 272 xch a,@hlC ... 249, 272 xch a,@rpa1 ... 249, 272 xch xa,@hl ... 249, 273 xch a,mem ... 249, 273 xch xa,mem ... 249, 273 xch a,reg1 ... 249, 273 xch xa,rp ...249, 273 [table reference instructions] movt xa,@pcde ... 250, 274 movt xa,@pcxa ... 250, 275 movt xa,@bcde ... 250, 276 movt xa,@bcxa ... 250, 276 [bit transfer instructions] mov1 cy,fmem.bit ... 250, 277 mov1 cy,pmem.@l ... 250, 277 mov1 cy,@h+mem.bit ... 250, 277 mov1 fmem.bit,cy ... 250, 277 mov1 pmem.@l,cy ... 250, 277 mov1 @h+mem.bit,cy ... 250, 277 [arithmetic/logical instructions] adds a,#n4 ... 250, 277 adds xa,#n8 ... 250, 278 adds a,@hl ... 250, 278 adds xa,rp ... 250, 278 adds rp1,xa ... 250, 278 addc a,@hl ... 250, 278 addc xa,rp ... 250, 279 addc rp1,xa ... 250, 279 subs a,@hl ... 250, 279 subs xa,rp ... 250, 279 subs rp1,xa ... 250, 280 subc a,@hl ... 250, 280 subc xa,rp ... 250, 280 subc rp1,xa ... 250, 280 and a,#n4 ... 251, 280 and a,@hl ... 251, 281 and xa,rp ...251, 281 and rp1,xa... 251, 281 or a,#n4 ... 251, 281 d
316 m pd750108 user's manual or a,@hl ... 251, 281 or xa,rp ... 251, 281 or rp1,xa ... 251, 282 xor a,#n4 ... 251, 282 xor a,@hl ... 251, 282 xor xa,rp ... 251, 282 xor rp1,xa ... 251, 282 [accumulator manipulation instructions] rorc a ... 251, 283 not a ... 251, 283 [increment/decrement instructions] incs reg ... 251, 283 incs rp1 ... 251, 283 incs @hl ... 251, 283 incs mem ... 251, 284 decs reg ... 251, 284 decs rp ... 251, 284 [compare instructions] ske reg,#n4 ... 251, 284 ske @hl,#n4 ... 251, 284 ske a,@hl ... 251, 284 ske xa,@hl ... 251, 285 ske a,reg ... 251, 285 ske xa,rp ... 251, 285 [carry flag manipulation instructions] set1 cy ... 251, 285 clr1 cy ... 251, 285 skt cy ... 251, 285 not1 cy ... 251, 286 [memory bit manipulation instructions] set1 mem.bit ... 252, 286 set1 fmem.bit ... 252, 286 set1 pmem.@l ... 252, 286 set1 @h+mem.bit ... 252, 286 clr1 mem.bit ... 252, 286 clr1 fmem.bit ... 252, 286 clr1 pmem.@l ... 252, 286 clr1 @h+mem.bit ... 252, 286 skt mem.bit ... 252, 287 skt fmem.bit ... 252, 287 skt pmem.@l ... 252, 287 skt @h+mem.bit ... 252, 287 skf mem.bit ... 252, 287 skf fmem.bit ... 252, 287 skf pmem.@l ... 252, 287 skf @h+mem.bit ... 252, 287 sktclr fmem.bit ... 252, 287 sktclr pmem.@l ... 252, 287 sktclr @h+mem.bit ... 252, 287 and1 cy,fmem.bit ... 252, 288 and1 cy,pmem.@l ... 252, 288 and1 cy,@h+mem.bit ... 252, 288 or1 cy,fmem.bit ... 252, 288 or1 cy,pmem.@l ... 252, 288 or1 cy,@h+mem.bit ... 252, 288 xor1 cy,fmem.bit ... 252, 288 xor1 cy,pmem,@l ... 252, 288 xor1 cy,@h+mem.bit ... 252, 288 [branch instructions] br addr ... 253, 288 br addr1 ... 253, 289 br !addr ... 254, 289 br $addr ... 254, 289 br $addr1 ... 254, 289 br pcde ... 254, 291 br pcxa ... 254, 291 br bcde ... 254, 292 br bcxa ... 255, 292
317 bra !addr1 ... 255, 289 brcb !caddr ... 255, 290 tbr addr ... 260, 292 [subroutine stack control instructions] calla !addr1 ... 255, 293 call !addr ... 256, 293 callf !faddr ... 256, 294 tcall !addr ... 260, 294 ret ... 257, 295 rets ... 258, 295 reti ... 258, 296 push rp ... 259, 296 push bs ... 259, 297 pop rp ... 259, 297 pop bs ... 259, 297 [interrupt control instructions] ei ... 259, 297 ei iexxx ... 259, 297 di ... 259, 297 di iexxx ... 259, 298 [i/o instructions] in a,portn ... 259, 298 in xa,portn ... 259, 298 out portn,a ... 259, 298 out portn,xa ... 259, 298 [cpu control instructions] halt ... 259, 299 stop ... 259, 299 nop ... 259, 299 [special instructions] sel rbn ... 260, 299 sel mbn ... 260, 299 geti taddr ... 260, 300 appendix d instruction index
318 m pd750108 user's manual d.2 instruction index (alphabetical order) [a] addc a,@hl ... 250, 278 addc rp1,xa .. 250, 279 addc xa,rp ... 250, 279 adds a,#n4 ... 250, 277 adds a,@hl ... 250, 278 adds rp1,xa ... 250, 278 adds xa,rp ... 250, 278 adds xa,#n8 ... 250, 278 and a,#n4 ... 251, 280 and a,@hl ... 251, 281 and rp1,xa ... 251, 281 and xa,rp ... 251, 281 and1 cy,fmem.bit ... 252, 288 and1 cy,pmem.@l ... 252, 288 and1 cy,@h+mem.bit ... 252, 288 [b] br addr ... 253, 288 br addr1 ... 253, 289 br bcde ... 254, 292 br bcxa ... 255, 292 br pcde ... 254, 291 br pcxa ... 254, 291 br !addr ... 254, 289 br $addr ... 254, 289 br $addr1 ... 254, 289 bra !addr1 ... 255, 289 brcb !caddr ... 255, 290 [c] call !addr ... 256, 293 calla !addr1 ... 255, 293 callf !faddr ... 256, 294 clr1 cy ... 251, 285 clr1 fmem.bit ... 252, 286 clr1 mem.bit ... 252, 286 clr1 pmem.@l ... 252, 286 clr1 @h+mem.bit ... 252, 286 [d] decs reg ... 251, 284 decs rp ... 251, 284 di ... 259, 297 di iexxx ... 259, 298 [e] ei ... 259, 297 ei iexxx ... 259, 297 [g] geti taddr ... 260, 300 [h] halt ... 259, 299 [i] in a,portn ... 259, 298 in xa,portn ... 259, 298 incs mem ... 251, 284 incs reg ... 251, 283 incs rp1 ... 251, 283 incs @hl ... 251, 283 [m] mov a,mem ... 249, 270 mov a,reg ... 249, 271 mov a,#n4 ... 249, 268 mov a,@hl ... 249, 269 mov a,@hl+ ... 249, 269 mov a,@hlC ... 249, 269
319 mov a,@rpa1 ... 249, 269 mov hl,#n8 ... 249, 269 mov mem,a ... 249, 271 mov mem,xa ... 249, 271 mov reg1,a ... 249, 272 mov reg1,#n4 ... 249, 269 mov rp1,xa ... 249, 272 mov rp2,#n8 ... 249, 269 mov xa,mem ... 249, 271 mov xa,rp ... 249, 271 mov xa,#n8 ... 249, 269 mov xa,@hl ... 249, 270 mov @hl,a ... 249, 270 mov @hl,xa ... 249, 270 movt xa,@bcde ... 250, 276 movt xa,@bcxa ... 250, 276 movt xa,@pcde ... 250, 274 movt xa,@pcxa ... 250, 275 mov1 cy,fmem.bit ... 250, 277 mov1 cy,pmem.@l ... 250, 277 mov1 cy,@h+mem.bit ... 250, 277 mov1 fmem.bit,cy ... 250, 277 mov1 pmem.@l,cy ... 250, 277 mov1 @h+mem.bit,cy ... 250, 277 [n] nop ... 259, 299 not a ... 251, 283 not1 cy ... 251, 286 [o] or a,#n4 ... 251, 281 or a,@hl ... 251, 281 or rp1,xa ... 251, 282 or xa,rp ... 251, 281 or1 cy,fmem.bit ... 252, 288 or1 cy,pmem.@l ... 252, 288 or1 cy,@h+mem.bit ... 252, 288 out portn,a ... 259, 298 out portn,xa ... 259, 298 [p] pop bs ... 259, 297 pop rp ... 259, 297 push bs ... 259, 297 push rp ... 259, 296 [r] ret ... 257, 295 reti ... 258, 296 rets ... 258, 295 rorc a ... 251, 283 [s] sel mbn ... 260, 299 sel rbn ... 260, 299 set1 cy ... 251, 285 set1 fmem.bit ... 252, 286 set1 mem.bit ... 252, 286 set1 pmem.@l ... 252, 286 set1 @h+mem.bit ... 252, 286 ske a,reg ... 251, 285 ske a,@hl ... 251, 284 ske reg,#n4 ... 251, 284 ske xa,rp ... 251, 285 ske xa,@hl ... 251, 285 ske @hl,#n4 ... 251, 284 skf fmem.bit ... 252, 287 skf mem.bit ... 252, 287 skf pmem.@l ... 252, 287 skf @h+mem.bit ... 252, 287 skt cy ... 251, 285 skt fmem.bit ... 252, 287 skt mem.bit ... 252, 287 appendix d instruction index
320 m pd750108 user's manual skt pmem.@l ... 252, 287 skt @h+mem.bit ... 252, 287 sktclr fmem.bit ... 252, 287 sktclr pmem.@l ... 252, 287 sktclr @h+mem.bit ... 252, 287 stop ... 259, 299 subc a,@hl ... 250, 280 subc rp1,xa ... 250, 280 subc xa,rp ... 250, 280 subs a,@hl ... 250, 279 subs rp1,xa ... 250, 280 subs xa,rp ... 250, 279 [t] tbr addr ... 260, 292 tcall !addr ... 260, 294 [x] xch a,mem ... 249, 273 xch a,reg1 ... 249, 273 xch a,@hl ... 249, 272 xch a,@hl+ ... 249, 272 xch a,@hlC ... 249, 272 xch a,@rpa1 ... 249, 272 xch xa,mem ... 249, 273 xch xa,rp ... 249, 273 xch xa,@hl ... 249, 273 xor a,#n4 ... 251, 282 xor a,@hl ... 251, 282 xor rp1,xa ... 251, 282 xor xa,rp ... 251, 282 xor1 cy,fmem.bit ... 252, 288 xor1 cy,pmem,@l ... 252, 288 xor1 cy,@h+mem.bit ... 252, 288
321 appendix e hardware index e.1 hardware index (alphabetical order with respect to the hardware name) int1 edge detection mode register (im1) ... 197 int1 interrupt enable flag (ie1) ... 191 int1 interrupt request flag (irq1) ... 191 int2 edge detection mode register (im2) ... 217 int2 interrupt enable flag (ie2) ... 214 int2 interrupt request flag (irq2) ... 214 int4 interrupt enable flag (ie4) ... 191 int4 interrupt request flag (irq4) ... 191 [k] key interrupt input (kr0-kr7) ... 215 [m] memory bank enable flag (mbe) ... 23, 66 memory bank select register (mbs) ... 23, 67 [p] port 0 to port 8 (port0-port8) ... 70 port mode register group a (pmga) ... 77 port mode register group b (pmgb) ... 77 port mode register group c (pmgc) ... 77 processor clock control register (pcc) ... 88 program counter (pc) ... 49 program status word (psw) ... 64 pull-up resistor specification register group a (poga) ... 84 pull-up resistor specification register group b (pogb) ... 84 e [a] acknowledge detection flag (ackd) ... 135 acknowledge enable bit (acke) ... 135 acknowledge trigger bit (ackt) ... 135 [b] bank select register (bs) ... 67 basic interval timer (bt) ... 103 basic interval timer mode register (btm) ... 103 bit sequential buffer (bsb0-bsb3) ... 184 bt interrupt enable flag (iebt) ... 191 bt interrupt request flag (irqbt) ... 191 bus release detection flag (reld) ... 136 bus release trigger bit (relt) ... 136 busy enable bit (bsye) ... 135 [c] carry flag (cy) ... 64 clock mode register (wm) ... 109 clock output mode register (clom) ... 101 command detection flag (cmdd) ... 135 command trigger bit (cmdt) ... 136 [i] interrupt enable flag for clock timer (iew) ... 214 interrupt master enable flag (ime) ... 193 interrupt priority specification register (ips) ... 192 interrupt request flag for clock timer (irqw) ... 214 interrupt status flag (ist0, ist1) ... 65, 198 int0 edge detection mode register (im0) ... 197 int0 interrupt enable flag (ie0) ... 191 int0 interrupt request flag (irq0) ... 191
322 m pd750108 user's manual timer/event counter 0 mode register (tm0) ... 114 timer/event counter 0 modulo register (tmod0) ... 112 timer/event counter 0 output enable flag (toe0) ... 117 [w] wake-up function specification bit (wup) ... 131 watchdog timer enable flag (wdtm) ... 105 [r] register bank enable flag (rbe) ... 36, 66 register bank select register (rbs) ... 36, 67 [s] serial bus interface control register (sbic) ... 134 serial interface interrupt enable flag (iecsi) ... 191 serial interface interrupt request flag (irqcsi) ... 191 serial interface operation enable/disable specification bit (csie) ... 131 serial operation mode register (csim) ... 130 shift register (sio) ... 137 signal from address comparator (coi) ... 131 skip flag (sk0-sk2) ... 65 slave address register (sva) ... 137 stack bank select register (sbs) ... 48, 60 stack pointer (sp) ... 60 sub-oscillator control register (sos) ... 97 system clock control register (scc) ... 90 [t] timer counter 1 interrupt enable flag (iet1) ... 191 timer counter 1 interrupt request flag (irqt1) ... 191 timer counter 1 count register (t1) ... 113 timer/event counter 1 mode register (tm1) ... 114 timer counter 1 modulo register (tmod1) ... 113 timer/event counter 1 output enable flag (toe1) ... 117 timer/event counter 0 count register (t0) ... 112 timer/event counter 0 interrupt enable flag (iet0) ... 191 timer/event counter 0 interrupt request flag (irqt0) ... 191
323 e.2 hardware index (alphabetical order with respect to the hardware symbol) appendix e hardware index [a] ackd ... 135 acke ... 135 ackt ... 135 [b] bs ... 67 bsb0-bsb3 ... 184 bsye ... 135 bt ... 103 btm ... 103 [c] clom ... 101 cmdd ... 135 cmdt ... 136 coi ... 131 csie ... 131 csim .. 130 cy ... 64 [i] ie0 ... 191 ie1 ... 191 ie2 ... 214 ie4 ... 191 iebt ... 191 iecsi ... 191 iet0 ... 191 iet1 ... 191 iew ... 214 im0, im1 ... 197 im2 ... 217 ime ... 193 ips ... 192 irq0 ... 191 irq1 ... 191 irq2 ... 214 irq4 ... 191 irqbt ... 191 irqcsi ... 191 irqt0 ... 191 irqt1 ... 191 irqw ... 214 ist0 ... 65, 198 ist1 ... 65, 198 [k] kr0-kr7 ... 215 [m] mbe ... 23, 66 mbs ... 23, 67 [p] pc ... 49 pcc ... 88 pmga ... 77 pmgb ... 77 pmgc ... 77 poga ... 84 pogb ... 84 port0-port8 ... 70 psw ... 64 [r] rbe ... 36, 66 rbs ... 36, 67 reld ... 136 relt ... 136
324 m pd750108 user's manual [s] sbic ... 134 sbs ... 48, 60 scc ... 90 sio ... 137 sk0, sk1, sk2 ... 65 sos ... 97 sp ... 60 sva ... 137 [t] t0 ... 112 t1 ... 113 toe0 ... 117 toe1 ... 117 tm0 ... 114 tm1 ... 114 tmod0 ... 112 tmod1 ... 113 [w] wdtm ... 105 wm ... 109 wup ... 131
325 f appendix f revision history the revision history is shown below. the chapters described in the revised-chapter column indicate those for the corresponding edition. edition major changes revised chapter second the m PD750104, m pd750106, m pd750108, and m pd75p0116 have throughout already been developed. the data bus pins (d0-d7) have been added. connection of unused pins has been changed. chapter 2 writing to the program memory has been changed. chapter 9 reading the program memory has been changed. the target to be compared has been changed from the m pd75008 appendix a to m pd750008. *
326 m pd750108 user's manual [memo]
327 although nec has taken all possible steps to ensure that the documentation supplied to our customers is complete, bug free and up-to-date, we readily accept that errors may occur. despite all the care and precautions we've taken, you may encounter problems in the documentation. please complete this form whenever you'd like to report errors or suggest improvements to us. hong kong, philippines, oceania nec electronics hong kong ltd. fax: +852-2886-9022/9044 korea nec electronics hong kong ltd. seoul branch fax: 02-528-4411 taiwan nec electronics taiwan ltd. fax: 02-719-5951 address north america nec electronics inc. corporate communications dept. fax: 1-800-729-9288 1-408-588-6130 europe nec electronics (europe) gmbh technical documentation dept. fax: +49-211-6503-274 south america nec do brasil s.a. fax: +55-11-889-1689 asian nations except philippines nec electronics singapore pte. ltd. fax: +65-250-3583 japan nec corporation semiconductor solution engineering division technical information support dept. fax: 044-548-7900 i would like to report the following error/make the following suggestion: document title: document number: page number: thank you for your kind support. if possible, please fax the referenced page or drawing. excellent good acceptable poor document rating clarity technical accuracy organization cs 96.8 name company from: tel. fax facsimile message
328 m pd750108 user's manual


▲Up To Search▲   

 
Price & Availability of PD750104

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X